﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Assist;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using Autodesk.Revit.UI;
using YJKDragCurveJig;
using YJKStairs.CommonUnit;
using YJKStairs.DataInfos;
using YJKStairs.Form;
using YJKStairs.Kit;

namespace YJKStairs.Manage
{
	public class StairsManager
	{
		public StairsManager(ExternalCommandData commandData)
		{
			this.m_Revit = commandData;
			this.m_Document = this.m_Revit.Application.ActiveUIDocument.Document;
			this.m_StairsCreator = new StairsCreator(commandData);
		}

		private void SetDblRunStairsRailing(bool bInner, bool bOuter, LinearDoubleRunStairsForm dlg, ref LinearDoubleRunStairs Stairs)
		{
			if (bOuter)
			{
				double outerRailHeight = dlg.GetOuterRailHeight();
				RailingType outerRailType = dlg.GetOuterRailType();
				BaseRaillingData baseRaillingData = new BaseRaillingData();
				baseRaillingData.m_ptStart = Stairs.m_LeftRunData.PtRunBottomLeft;
				baseRaillingData.TheRailingType = outerRailType;
				baseRaillingData.RailingHeight = outerRailHeight;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.m_ptStart = Stairs.m_LeftRunData.PtRunTopLeft;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.TheRailingType = outerRailType;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.m_ptStart = Stairs.m_RightRunData.PtRunTopRight;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.TheRailingType = outerRailType;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.m_ptStart = Stairs.m_RightRunData.PtRunBottomRight;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.TheRailingType = outerRailType;
				Stairs.m_listRail.Add(baseRaillingData);
			}
			if (bInner)
			{
				double innerRailHeight = dlg.GetInnerRailHeight();
				RailingType innerRailType = dlg.GetInnerRailType();
				BaseRaillingData baseRaillingData2 = new BaseRaillingData();
				baseRaillingData2.m_ptStart = Stairs.m_LeftRunData.PtRunBottomRight;
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.TheRailingType = innerRailType;
				Stairs.m_listRail.Add(baseRaillingData2);
				baseRaillingData2 = new BaseRaillingData();
				baseRaillingData2.m_ptStart = Stairs.m_LeftRunData.PtRunTopRight;
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.TheRailingType = innerRailType;
				Stairs.m_listRail.Add(baseRaillingData2);
				baseRaillingData2 = new BaseRaillingData();
				baseRaillingData2.m_ptStart = Stairs.m_RightRunData.PtRunBottomLeft;
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.TheRailingType = innerRailType;
				Stairs.m_listRail.Add(baseRaillingData2);
				baseRaillingData2 = new BaseRaillingData();
				baseRaillingData2.m_ptStart = Stairs.m_RightRunData.PtRunTopLeft;
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.TheRailingType = innerRailType;
				Stairs.m_listRail.Add(baseRaillingData2);
			}
		}

		public bool AddLinearDoubleRunStairs()
		{
			LinearDoubleRunStairsForm linearDoubleRunStairsForm = new LinearDoubleRunStairsForm(this.m_Revit);
			DialogResult dialogResult;
			while ((dialogResult = linearDoubleRunStairsForm.ShowDialog()) == DialogResult.OK && linearDoubleRunStairsForm.theMeasureType != LinearDoubleRunStairsForm.MeasureType.MT_None)
			{
				if (LinearDoubleRunStairsForm.MeasureType.MT_StairsWidth == linearDoubleRunStairsForm.theMeasureType)
				{
					double stairsWidth = 0.0;
					if (this.GetLength("梯间宽度", ref stairsWidth))
					{
						linearDoubleRunStairsForm.StairsWidth = stairsWidth;
						linearDoubleRunStairsForm.SaveData();
					}
				}
				else if (LinearDoubleRunStairsForm.MeasureType.MT_StairsLength == linearDoubleRunStairsForm.theMeasureType)
				{
					double stairsLength = 0.0;
					if (this.GetLength("梯间长度", ref stairsLength))
					{
						linearDoubleRunStairsForm.StairsLength = stairsLength;
						linearDoubleRunStairsForm.SaveData();
					}
				}
				else if (LinearDoubleRunStairsForm.MeasureType.MT_Angle == linearDoubleRunStairsForm.theMeasureType)
				{
					double rotateAngle = 0.0;
					if (this.GetAngle(ref rotateAngle))
					{
						linearDoubleRunStairsForm.RotateAngle = rotateAngle;
						linearDoubleRunStairsForm.SaveData();
					}
				}
			}
			if (DialogResult.Cancel == dialogResult)
			{
				return false;
			}
			double rotateAngle2 = linearDoubleRunStairsForm.RotateAngle;
			int insertPointIndex = linearDoubleRunStairsForm.GetInsertPointIndex();
			bool leftSideUp = linearDoubleRunStairsForm.GetLeftSideUp();
			bool noteInfo = linearDoubleRunStairsForm.GetNoteInfo();
			bool tbmirror = linearDoubleRunStairsForm.GetTBMirror();
			bool lrmirror = linearDoubleRunStairsForm.GetLRMirror();
			bool bottomBeam = linearDoubleRunStairsForm.GetBottomBeam();
			bool middleBeam = linearDoubleRunStairsForm.GetMiddleBeam();
			bool topBeam = linearDoubleRunStairsForm.GetTopBeam();
			bool innerRail = linearDoubleRunStairsForm.GetInnerRail();
			bool outerRail = linearDoubleRunStairsForm.GetOuterRail();
			this.m_StairsCreator = new LinearDoubleRunStairsCreator(this.m_Revit);
			LinearDoubleRunStairs linearDoubleRunStairs = new LinearDoubleRunStairs(this.m_StairsCreator);
			linearDoubleRunStairs.m_sUsingRange = linearDoubleRunStairsForm.UsingRange;
			linearDoubleRunStairs.m_dTopOffset = Common.MMToFeet(linearDoubleRunStairsForm.GetTopOffset());
			linearDoubleRunStairs.m_dBottomOffset = Common.MMToFeet(linearDoubleRunStairsForm.BottomOffset);
			linearDoubleRunStairs.m_dStairsWidth = Common.MMToFeet(linearDoubleRunStairsForm.StairsWidth);
			linearDoubleRunStairs.m_dStairsLength = Common.MMToFeet(linearDoubleRunStairsForm.StairsLength);
			linearDoubleRunStairs.m_dWellWidth = Common.MMToFeet(linearDoubleRunStairsForm.WellWidth);
			linearDoubleRunStairs.m_LeftRunData = linearDoubleRunStairsForm.GetLeftRunData();
			linearDoubleRunStairs.m_RightRunData = linearDoubleRunStairsForm.GetRightRunData();
			linearDoubleRunStairs.m_LandData = linearDoubleRunStairsForm.GetLandingData();
			linearDoubleRunStairs.m_TopLandData = linearDoubleRunStairsForm.GetTopLandingData();
			linearDoubleRunStairs.m_listSupport = linearDoubleRunStairsForm.GetSupportData();
			linearDoubleRunStairs.m_BeamData = linearDoubleRunStairsForm.GetBeamData();
			linearDoubleRunStairs.m_FloorType = linearDoubleRunStairsForm.GetFloorType();
			linearDoubleRunStairs.m_arLandWidth = linearDoubleRunStairsForm.GetLandWidth();
			linearDoubleRunStairs.m_dBottomElevation = linearDoubleRunStairsForm.GetBottomElevation();
			linearDoubleRunStairs.m_dLevelValue = linearDoubleRunStairsForm.GetLevelValue();
			linearDoubleRunStairs.m_bNoteUpStairs = noteInfo;
			new LinearDoubleRunStairsKit(this.m_Revit.Application.Application).LinearDoubleRunStairsProfileCurves(ref linearDoubleRunStairs, noteInfo, insertPointIndex, lrmirror, tbmirror, leftSideUp, rotateAngle2, bottomBeam, middleBeam, topBeam);
			this.SetDblRunStairsRailing(innerRail, outerRail, linearDoubleRunStairsForm, ref linearDoubleRunStairs);
			List<CurveInfo> list = new List<CurveInfo>();
			foreach (SingleRunCurveInfo singleRunCurveInfo in linearDoubleRunStairs.m_listRunCurve)
			{
				list.AddRange(singleRunCurveInfo.RunBoundaryCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunRiserCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunPathCurvesInfoList);
			}
			foreach (LandingCurveInfo landingCurveInfo in linearDoubleRunStairs.m_listLandCurve)
			{
				list.AddRange(landingCurveInfo.m_arCurveInfo);
			}
			foreach (LandingCurveInfo landingCurveInfo2 in linearDoubleRunStairs.m_listTopLandCurve)
			{
				list.AddRange(landingCurveInfo2.m_arCurveInfo);
			}
			List<JigEdgeInfo> list2 = new List<JigEdgeInfo>();
			foreach (CurveInfo curveInfo in list)
			{
				if (!(null == curveInfo.CurveObj))
				{
					JigEdgeInfo item = new JigEdgeInfo(curveInfo.CurveObj);
					list2.Add(item);
				}
			}
			XYZ xyz = null;
			List<JigTextInfo> textInfos = new List<JigTextInfo>();
			if (!DragCurveJigInterface.GetInsertPosition(this.m_Revit, list2, false, textInfos, false, linearDoubleRunStairs.m_TransVector, ref xyz))
			{
				return false;
			}
			linearDoubleRunStairs.m_ptRealInsert = xyz;
			linearDoubleRunStairs.m_TransVector = xyz - linearDoubleRunStairs.m_TransVector;
			Transform transform = RevitVersionFuncs.CreateTranslation(new XYZ(linearDoubleRunStairs.m_TransVector.X, linearDoubleRunStairs.m_TransVector.Y, 0.0));
			linearDoubleRunStairs.m_Transform = transform.Multiply(linearDoubleRunStairs.m_Transform);
			linearDoubleRunStairs.TransFormRailPoints();
			linearDoubleRunStairs.TransFormOutSupportPoints();
			linearDoubleRunStairs.DrawStairs();
			return true;
		}

		private void SetMultiRunStairsRailing(bool bInner, bool bOuter, MultiRunStairsForm dlg, ref MultiRunStairs Stairs)
		{
			if (bOuter)
			{
				double outerRailHeight = dlg.GetOuterRailHeight();
				RailingType outerRailType = dlg.GetOuterRailType();
				BaseRaillingData baseRaillingData = new BaseRaillingData();
				if (dlg.GetLeftSideUp())
				{
					baseRaillingData.m_ptStart = Stairs.m_lstRunData[0].PtRunBottomLeft;
				}
				else
				{
					baseRaillingData.m_ptStart = Stairs.m_lstRunData[0].PtRunBottomRight;
				}
				baseRaillingData.TheRailingType = outerRailType;
				baseRaillingData.RailingHeight = outerRailHeight;
				Stairs.m_listRail.Add(baseRaillingData);
			}
			if (bInner)
			{
				double innerRailHeight = dlg.GetInnerRailHeight();
				RailingType innerRailType = dlg.GetInnerRailType();
				BaseRaillingData baseRaillingData2 = new BaseRaillingData();
				if (dlg.GetLeftSideUp())
				{
					baseRaillingData2.m_ptStart = Stairs.m_lstRunData[0].PtRunBottomRight;
				}
				else
				{
					baseRaillingData2.m_ptStart = Stairs.m_lstRunData[0].PtRunBottomLeft;
				}
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.TheRailingType = innerRailType;
				Stairs.m_listRail.Add(baseRaillingData2);
			}
		}

		public bool AddMultiRunStairs()
		{
			MultiRunStairsForm multiRunStairsForm = new MultiRunStairsForm(this.m_Revit);
			DialogResult dialogResult;
			while ((dialogResult = multiRunStairsForm.ShowDialog()) == DialogResult.OK && multiRunStairsForm.theMeasureType != MultiRunStairsForm.MeasureType.MT_None)
			{
				if (MultiRunStairsForm.MeasureType.MT_StairsWidth == multiRunStairsForm.theMeasureType)
				{
					double stairsWidth = 0.0;
					if (this.GetLength("梯间宽度", ref stairsWidth))
					{
						multiRunStairsForm.StairsWidth = stairsWidth;
						multiRunStairsForm.SaveData();
					}
				}
				else if (MultiRunStairsForm.MeasureType.MT_StairsLength == multiRunStairsForm.theMeasureType)
				{
					double stairsLength = 0.0;
					if (this.GetLength("梯间长度", ref stairsLength))
					{
						multiRunStairsForm.StairsLength = stairsLength;
						multiRunStairsForm.SaveData();
					}
				}
				else if (MultiRunStairsForm.MeasureType.MT_Angle == multiRunStairsForm.theMeasureType)
				{
					double rotateAngle = 0.0;
					if (this.GetAngle(ref rotateAngle))
					{
						multiRunStairsForm.RotateAngle = rotateAngle;
						multiRunStairsForm.SaveData();
					}
				}
			}
			if (DialogResult.Cancel == dialogResult)
			{
				return false;
			}
			double rotateAngle2 = multiRunStairsForm.RotateAngle;
			int insertPointIndex = multiRunStairsForm.GetInsertPointIndex();
			bool leftSideUp = multiRunStairsForm.GetLeftSideUp();
			bool noteInfo = multiRunStairsForm.GetNoteInfo();
			bool tbmirror = multiRunStairsForm.GetTBMirror();
			bool lrmirror = multiRunStairsForm.GetLRMirror();
			bool bottomBeam = multiRunStairsForm.GetBottomBeam();
			bool middleBeam = multiRunStairsForm.GetMiddleBeam();
			bool topBeam = multiRunStairsForm.GetTopBeam();
			bool innerRail = multiRunStairsForm.GetInnerRail();
			bool outerRail = multiRunStairsForm.GetOuterRail();
			this.m_StairsCreator = new MultiRunStairsCreator(this.m_Revit);
			MultiRunStairs multiRunStairs = new MultiRunStairs(this.m_StairsCreator);
			multiRunStairs.m_sUsingRange = multiRunStairsForm.UsingRange;
			multiRunStairs.m_dTopOffset = Common.MMToFeet(multiRunStairsForm.GetTopOffset());
			multiRunStairs.m_dBottomOffset = Common.MMToFeet(multiRunStairsForm.BottomOffset);
			multiRunStairs.m_dStairsWidth = Common.MMToFeet(multiRunStairsForm.StairsWidth);
			multiRunStairs.m_dStairsLength = Common.MMToFeet(multiRunStairsForm.StairsLength);
			multiRunStairs.m_dWellWidth = Common.MMToFeet(multiRunStairsForm.WellWidth);
			multiRunStairs.m_lstRunData = multiRunStairsForm.GetLstLineRunData();
			multiRunStairs.m_nRunNum = multiRunStairsForm.RunNum;
			multiRunStairs.m_LandData = multiRunStairsForm.GetLandingData();
			multiRunStairs.m_listSupport = multiRunStairsForm.GetSupportData();
			multiRunStairs.m_BeamData = multiRunStairsForm.GetBeamData();
			multiRunStairs.m_FloorType = multiRunStairsForm.GetFloorType();
			multiRunStairs.m_dBottomElevation = multiRunStairsForm.GetBottomElevation();
			multiRunStairs.m_dLevelValue = multiRunStairsForm.GetLevelValue();
			multiRunStairs.m_bNoteUpStairs = noteInfo;
			multiRunStairs.m_bHasTopLanding = multiRunStairsForm.HasTopLanding;
			new MultiRunStairsKit(this.m_Revit.Application.Application).MultiRunStairsProfileCurves(ref multiRunStairs, noteInfo, insertPointIndex, lrmirror, tbmirror, leftSideUp, rotateAngle2, bottomBeam, middleBeam, topBeam);
			this.SetMultiRunStairsRailing(innerRail, outerRail, multiRunStairsForm, ref multiRunStairs);
			List<CurveInfo> list = new List<CurveInfo>();
			foreach (SingleRunCurveInfo singleRunCurveInfo in multiRunStairs.m_listRunCurve)
			{
				list.AddRange(singleRunCurveInfo.RunBoundaryCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunRiserCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunPathCurvesInfoList);
			}
			foreach (LandingCurveInfo landingCurveInfo in multiRunStairs.m_listLandCurve)
			{
				list.AddRange(landingCurveInfo.m_arCurveInfo);
			}
			List<JigEdgeInfo> list2 = new List<JigEdgeInfo>();
			foreach (CurveInfo curveInfo in list)
			{
				if (!(null == curveInfo.CurveObj))
				{
					JigEdgeInfo item = new JigEdgeInfo(curveInfo.CurveObj);
					list2.Add(item);
				}
			}
			XYZ xyz = null;
			List<JigTextInfo> textInfos = new List<JigTextInfo>();
			if (!DragCurveJigInterface.GetInsertPosition(this.m_Revit, list2, false, textInfos, false, multiRunStairs.m_TransVector, ref xyz))
			{
				return false;
			}
			multiRunStairs.m_ptRealInsert = xyz;
			multiRunStairs.m_TransVector = xyz - multiRunStairs.m_TransVector;
			Transform transform = RevitVersionFuncs.CreateTranslation(new XYZ(multiRunStairs.m_TransVector.X, multiRunStairs.m_TransVector.Y, 0.0));
			multiRunStairs.m_Transform = transform.Multiply(multiRunStairs.m_Transform);
			multiRunStairs.TransFormRailPoints();
			multiRunStairs.TransFormOutSupportPoints();
			multiRunStairs.DrawStairs();
			return true;
		}

		private void SetLinearPlatformStairsRailing(bool bInnerRail, bool bOuterRail, LinearPlatformStairsForm dlg, ref LinearPlatformStairs Stairs)
		{
			LineRunData downRunData = Stairs.m_DownRunData;
			LineRunData upRunData = Stairs.m_UpRunData;
			if (bOuterRail)
			{
				double outerRailHeight = dlg.GetOuterRailHeight();
				RailingType outerRailType = dlg.GetOuterRailType();
				BaseRaillingData baseRaillingData = new BaseRaillingData();
				baseRaillingData.m_ptStart = downRunData.PtRunBottomRight;
				baseRaillingData.TheRailingType = outerRailType;
				baseRaillingData.RailingHeight = outerRailHeight;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.m_ptStart = downRunData.PtRunTopRight;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.TheRailingType = outerRailType;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.m_ptStart = upRunData.PtRunBottomRight;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.TheRailingType = outerRailType;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.m_ptStart = upRunData.PtRunTopRight;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.TheRailingType = outerRailType;
				Stairs.m_listRail.Add(baseRaillingData);
			}
			if (bInnerRail)
			{
				double innerRailHeight = dlg.GetInnerRailHeight();
				RailingType innerRailType = dlg.GetInnerRailType();
				BaseRaillingData baseRaillingData2 = new BaseRaillingData();
				baseRaillingData2.m_ptStart = downRunData.PtRunBottomLeft;
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.TheRailingType = innerRailType;
				Stairs.m_listRail.Add(baseRaillingData2);
				baseRaillingData2 = new BaseRaillingData();
				baseRaillingData2.m_ptStart = downRunData.PtRunTopLeft;
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.TheRailingType = innerRailType;
				Stairs.m_listRail.Add(baseRaillingData2);
				baseRaillingData2 = new BaseRaillingData();
				baseRaillingData2.m_ptStart = upRunData.PtRunBottomLeft;
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.TheRailingType = innerRailType;
				Stairs.m_listRail.Add(baseRaillingData2);
				baseRaillingData2 = new BaseRaillingData();
				baseRaillingData2.m_ptStart = upRunData.PtRunTopLeft;
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.TheRailingType = innerRailType;
				Stairs.m_listRail.Add(baseRaillingData2);
			}
		}

		public bool AddLinearPlatformStairs()
		{
			bool result = true;
			LinearPlatformStairsForm linearPlatformStairsForm = new LinearPlatformStairsForm(this.m_Revit);
			DialogResult dialogResult;
			while ((dialogResult = linearPlatformStairsForm.ShowDialog()) == DialogResult.OK && linearPlatformStairsForm.theMeasureType != LinearPlatformStairsForm.MeasureType.MT_None)
			{
				if (LinearPlatformStairsForm.MeasureType.MT_StairsWidth == linearPlatformStairsForm.theMeasureType)
				{
					double stairsWidth = 0.0;
					if (this.GetLength("梯间宽度", ref stairsWidth))
					{
						linearPlatformStairsForm.StairsWidth = stairsWidth;
						linearPlatformStairsForm.SaveData();
					}
				}
				else if (LinearPlatformStairsForm.MeasureType.MT_StairsLength == linearPlatformStairsForm.theMeasureType)
				{
					double stairsLength = 0.0;
					if (this.GetLength("梯间长度", ref stairsLength))
					{
						linearPlatformStairsForm.StairsLength = stairsLength;
						linearPlatformStairsForm.SaveData();
					}
				}
				else if (LinearPlatformStairsForm.MeasureType.MT_Angle == linearPlatformStairsForm.theMeasureType)
				{
					double rotateAngle = 0.0;
					if (this.GetAngle(ref rotateAngle))
					{
						linearPlatformStairsForm.RotateAngle = rotateAngle;
						linearPlatformStairsForm.SaveData();
					}
				}
			}
			if (DialogResult.Cancel == dialogResult)
			{
				return false;
			}
			double rotateAngle2 = linearPlatformStairsForm.RotateAngle;
			int insertPointIndex = linearPlatformStairsForm.GetInsertPointIndex();
			bool bottomUpStairs = linearPlatformStairsForm.GetBottomUpStairs();
			bool noteInfo = linearPlatformStairsForm.GetNoteInfo();
			bool tbmirror = linearPlatformStairsForm.GetTBMirror();
			bool lrmirror = linearPlatformStairsForm.GetLRMirror();
			bool bottomBeam = linearPlatformStairsForm.GetBottomBeam();
			bool middleBeam = linearPlatformStairsForm.GetMiddleBeam();
			bool topBeam = linearPlatformStairsForm.GetTopBeam();
			bool innerRail = linearPlatformStairsForm.GetInnerRail();
			bool outerRail = linearPlatformStairsForm.GetOuterRail();
			this.m_StairsCreator = new LinearPlatformStairsCreator(this.m_Revit);
			LinearPlatformStairs linearPlatformStairs = new LinearPlatformStairs(this.m_StairsCreator);
			linearPlatformStairs.m_dTopOffset = Common.MMToFeet(linearPlatformStairsForm.GetTopOffset());
			linearPlatformStairs.m_dBottomOffset = Common.MMToFeet(linearPlatformStairsForm.BottomOffset);
			linearPlatformStairs.m_dStairsWidth = Common.MMToFeet(linearPlatformStairsForm.StairsWidth);
			linearPlatformStairs.m_dStairsLength = Common.MMToFeet(linearPlatformStairsForm.StairsLength);
			linearPlatformStairs.m_DownRunData = linearPlatformStairsForm.GetDownRunData();
			linearPlatformStairs.m_UpRunData = linearPlatformStairsForm.GetUpRunData();
			linearPlatformStairs.m_LandData = linearPlatformStairsForm.GetLandingData();
			linearPlatformStairs.m_listSupport = linearPlatformStairsForm.GetSupportData();
			linearPlatformStairs.m_BeamData = linearPlatformStairsForm.GetBeamData();
			linearPlatformStairs.m_FloorType = linearPlatformStairsForm.GetFloorType();
			linearPlatformStairs.m_arLandWidth = linearPlatformStairsForm.GetLandWidth();
			linearPlatformStairs.m_dBottomElevation = linearPlatformStairsForm.GetBottomElevation();
			linearPlatformStairs.m_dLevelValue = linearPlatformStairsForm.GetLevelValue();
			linearPlatformStairs.m_bNoteUpStairs = noteInfo;
			linearPlatformStairs.m_sUsingRange = linearPlatformStairsForm.UsingRange;
			new LinearPlatformStairsKit(this.m_Revit.Application.Application).LinearPlatformStairsProfileCurves(ref linearPlatformStairs, noteInfo, insertPointIndex, lrmirror, tbmirror, bottomUpStairs, rotateAngle2, bottomBeam, middleBeam, topBeam);
			this.SetLinearPlatformStairsRailing(innerRail, outerRail, linearPlatformStairsForm, ref linearPlatformStairs);
			List<CurveInfo> list = new List<CurveInfo>();
			foreach (SingleRunCurveInfo singleRunCurveInfo in linearPlatformStairs.m_listRunCurve)
			{
				list.AddRange(singleRunCurveInfo.RunBoundaryCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunRiserCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunPathCurvesInfoList);
			}
			foreach (LandingCurveInfo landingCurveInfo in linearPlatformStairs.m_listLandCurve)
			{
				list.AddRange(landingCurveInfo.m_arCurveInfo);
			}
			List<JigEdgeInfo> list2 = new List<JigEdgeInfo>();
			foreach (CurveInfo curveInfo in list)
			{
				if (!(null == curveInfo.CurveObj))
				{
					JigEdgeInfo item = new JigEdgeInfo(curveInfo.CurveObj);
					list2.Add(item);
				}
			}
			XYZ xyz = null;
			List<JigTextInfo> textInfos = new List<JigTextInfo>();
			if (!DragCurveJigInterface.GetInsertPosition(this.m_Revit, list2, false, textInfos, false, linearPlatformStairs.m_TransVector, ref xyz))
			{
				return false;
			}
			linearPlatformStairs.m_ptRealInsert = xyz;
			linearPlatformStairs.m_TransVector = xyz - linearPlatformStairs.m_TransVector;
			Transform transform = RevitVersionFuncs.CreateTranslation(new XYZ(linearPlatformStairs.m_TransVector.X, linearPlatformStairs.m_TransVector.Y, 0.0));
			linearPlatformStairs.m_Transform = transform.Multiply(linearPlatformStairs.m_Transform);
			linearPlatformStairs.TransFormRailPoints();
			linearPlatformStairs.TransFormOutSupportPoints();
			linearPlatformStairs.DrawStairs();
			return result;
		}

		public bool AddLinearDoubleBranchParallelRunStairs()
		{
			LinearDoubleBranceParallelRunStairsForm linearDoubleBranceParallelRunStairsForm = new LinearDoubleBranceParallelRunStairsForm(this.m_Revit);
			DialogResult dialogResult;
			while ((dialogResult = linearDoubleBranceParallelRunStairsForm.ShowDialog()) == DialogResult.OK)
			{
				double num = 0.0;
				if (linearDoubleBranceParallelRunStairsForm.theMeasureType == LinearDoubleBranceParallelRunStairsForm.MeasureType.MT_None)
				{
					break;
				}
				if (LinearDoubleBranceParallelRunStairsForm.MeasureType.MT_StairsWidth == linearDoubleBranceParallelRunStairsForm.theMeasureType)
				{
					double num2 = 0.0;
					if (this.GetLength("楼梯宽度", ref num2))
					{
						if (!ValueValidatingKit.ValidatingDouble((num2 - linearDoubleBranceParallelRunStairsForm.SideStairsWidth * 2.0 - linearDoubleBranceParallelRunStairsForm.MiddleStairsWidth).ToString(), ValidatingType.GreaterThanZero, ref num))
						{
							MessageBox.Show("楼梯宽度参数不正确.", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
						}
						else
						{
							linearDoubleBranceParallelRunStairsForm.StairsWidth = num2;
							linearDoubleBranceParallelRunStairsForm.SaveData();
						}
					}
				}
				else if (LinearDoubleBranceParallelRunStairsForm.MeasureType.MT_SideWidth == linearDoubleBranceParallelRunStairsForm.theMeasureType)
				{
					double num3 = 0.0;
					if (this.GetLength("边梯段宽", ref num3))
					{
						if (!ValueValidatingKit.ValidatingDouble((linearDoubleBranceParallelRunStairsForm.StairsWidth - num3 * 2.0 - linearDoubleBranceParallelRunStairsForm.MiddleStairsWidth).ToString(), ValidatingType.GreaterThanZero, ref num))
						{
							MessageBox.Show("边梯段宽参数不正确.", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
						}
						else
						{
							linearDoubleBranceParallelRunStairsForm.SideStairsWidth = num3;
							linearDoubleBranceParallelRunStairsForm.SaveData();
						}
					}
				}
				else if (LinearDoubleBranceParallelRunStairsForm.MeasureType.MT_MiddleWidth == linearDoubleBranceParallelRunStairsForm.theMeasureType)
				{
					double num4 = 0.0;
					if (this.GetLength("中梯段宽", ref num4))
					{
						if (!ValueValidatingKit.ValidatingDouble((linearDoubleBranceParallelRunStairsForm.StairsWidth - linearDoubleBranceParallelRunStairsForm.SideStairsWidth * 2.0 - num4).ToString(), ValidatingType.GreaterThanZero, ref num))
						{
							MessageBox.Show("中梯段宽参数不正确.", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
						}
						else
						{
							linearDoubleBranceParallelRunStairsForm.MiddleStairsWidth = num4;
							linearDoubleBranceParallelRunStairsForm.SaveData();
						}
					}
				}
				else if (LinearDoubleBranceParallelRunStairsForm.MeasureType.MT_Angle == linearDoubleBranceParallelRunStairsForm.theMeasureType)
				{
					double rotateAngle = 0.0;
					if (this.GetAngle(ref rotateAngle))
					{
						linearDoubleBranceParallelRunStairsForm.RotateAngle = rotateAngle;
						linearDoubleBranceParallelRunStairsForm.SaveData();
					}
				}
			}
			if (DialogResult.Cancel == dialogResult)
			{
				return false;
			}
			double rotateAngle2 = linearDoubleBranceParallelRunStairsForm.RotateAngle;
			int treadAlignType = linearDoubleBranceParallelRunStairsForm.GetTreadAlignType();
			int insertPointIndex = linearDoubleBranceParallelRunStairsForm.GetInsertPointIndex();
			linearDoubleBranceParallelRunStairsForm.GetUpstairsLoc();
			bool noteInfo = linearDoubleBranceParallelRunStairsForm.GetNoteInfo();
			bool tbmirror = linearDoubleBranceParallelRunStairsForm.GetTBMirror();
			bool lrmirror = linearDoubleBranceParallelRunStairsForm.GetLRMirror();
			bool bottomBeam = linearDoubleBranceParallelRunStairsForm.GetBottomBeam();
			bool middleBeam = linearDoubleBranceParallelRunStairsForm.GetMiddleBeam();
			bool topBeam = linearDoubleBranceParallelRunStairsForm.GetTopBeam();
			this.m_StairsCreator = new DoubleBranchParallelStairsCreator(this.m_Revit);
			DoubleBranchParallelStairs doubleBranchParallelStairs = new DoubleBranchParallelStairs(this.m_StairsCreator);
			doubleBranchParallelStairs.m_dTopOffset = Common.MMToFeet(linearDoubleBranceParallelRunStairsForm.GetTopOffset());
			doubleBranchParallelStairs.m_dBottomOffset = Common.MMToFeet(linearDoubleBranceParallelRunStairsForm.BottomOffset);
			doubleBranchParallelStairs.m_dWellWidth = Common.MMToFeet(linearDoubleBranceParallelRunStairsForm.WellWidth);
			doubleBranchParallelStairs.m_LeftRunData = linearDoubleBranceParallelRunStairsForm.GetSideStairsData();
			doubleBranchParallelStairs.m_MidRunData = linearDoubleBranceParallelRunStairsForm.GetMiddleStairsData();
			doubleBranchParallelStairs.m_RightRunData = linearDoubleBranceParallelRunStairsForm.GetSideStairsData();
			doubleBranchParallelStairs.m_LandData = linearDoubleBranceParallelRunStairsForm.GetLandingData();
			doubleBranchParallelStairs.m_listSupport = linearDoubleBranceParallelRunStairsForm.GetSupportData();
			doubleBranchParallelStairs.m_listRail = linearDoubleBranceParallelRunStairsForm.GetRailingData();
			doubleBranchParallelStairs.m_BeamData = linearDoubleBranceParallelRunStairsForm.GetBeamData();
			doubleBranchParallelStairs.m_FloorType = linearDoubleBranceParallelRunStairsForm.GetFloorType();
			doubleBranchParallelStairs.m_dBottomElevation = linearDoubleBranceParallelRunStairsForm.GetBottomElevation();
			doubleBranchParallelStairs.m_dLevelValue = linearDoubleBranceParallelRunStairsForm.GetLevelValue();
			doubleBranchParallelStairs.m_bIsCenterUp = linearDoubleBranceParallelRunStairsForm.GetUpstairsLoc();
			doubleBranchParallelStairs.m_arLandWidth = linearDoubleBranceParallelRunStairsForm.GetLandWidth();
			doubleBranchParallelStairs.m_bNoteUpStairs = noteInfo;
			doubleBranchParallelStairs.m_sUsingRange = linearDoubleBranceParallelRunStairsForm.UsingRange;
			new DoubleBranchParallelStairsKit(this.m_Revit.Application.Application).LinearDoubleBranchParallelStarisProfileCurves(ref doubleBranchParallelStairs, noteInfo, treadAlignType, insertPointIndex, lrmirror, tbmirror, rotateAngle2, bottomBeam, middleBeam, false, topBeam);
			List<CurveInfo> list = new List<CurveInfo>();
			foreach (SingleRunCurveInfo singleRunCurveInfo in doubleBranchParallelStairs.m_listRunCurve)
			{
				list.AddRange(singleRunCurveInfo.RunBoundaryCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunRiserCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunPathCurvesInfoList);
			}
			list.AddRange(doubleBranchParallelStairs.m_listLandCurve.ElementAt(0).m_arCurveInfo);
			List<JigEdgeInfo> list2 = new List<JigEdgeInfo>();
			foreach (CurveInfo curveInfo in list)
			{
				if (!(null == curveInfo.CurveObj))
				{
					JigEdgeInfo item = new JigEdgeInfo(curveInfo.CurveObj);
					list2.Add(item);
				}
			}
			XYZ xyz = null;
			List<JigTextInfo> textInfos = new List<JigTextInfo>();
			if (!DragCurveJigInterface.GetInsertPosition(this.m_Revit, list2, false, textInfos, false, doubleBranchParallelStairs.m_ptPosition, ref xyz))
			{
				return false;
			}
			doubleBranchParallelStairs.m_ptRealInsert = xyz;
			doubleBranchParallelStairs.m_ptPosition = xyz - doubleBranchParallelStairs.m_ptPosition;
			Transform transform = RevitVersionFuncs.CreateTranslation(new XYZ(doubleBranchParallelStairs.m_ptPosition.X, doubleBranchParallelStairs.m_ptPosition.Y, 0.0));
			doubleBranchParallelStairs.m_Transform = transform.Multiply(doubleBranchParallelStairs.m_Transform);
			doubleBranchParallelStairs.TransFormRailPoints();
			doubleBranchParallelStairs.TransFormOutSupportPoints();
			doubleBranchParallelStairs.DrawStairs();
			return true;
		}

		public bool AddLinearDoubleBranchAngleRunStairs()
		{
			LinearDoubleBranceAngleRunStairsForm linearDoubleBranceAngleRunStairsForm = new LinearDoubleBranceAngleRunStairsForm(this.m_Revit);
			DialogResult dialogResult;
			while ((dialogResult = linearDoubleBranceAngleRunStairsForm.ShowDialog()) == DialogResult.OK && linearDoubleBranceAngleRunStairsForm.theMeasureType != LinearDoubleBranceAngleRunStairsForm.MeasureType.MT_None)
			{
				if (LinearDoubleBranceAngleRunStairsForm.MeasureType.MT_SideWidth == linearDoubleBranceAngleRunStairsForm.theMeasureType)
				{
					double sideStairsWidth = 0.0;
					if (this.GetLength("边梯段宽", ref sideStairsWidth))
					{
						linearDoubleBranceAngleRunStairsForm.SideStairsWidth = sideStairsWidth;
						linearDoubleBranceAngleRunStairsForm.SaveData();
					}
				}
				else if (LinearDoubleBranceAngleRunStairsForm.MeasureType.MT_MiddleWidth == linearDoubleBranceAngleRunStairsForm.theMeasureType)
				{
					double middleStairsWidth = 0.0;
					if (this.GetLength("中梯段宽", ref middleStairsWidth))
					{
						linearDoubleBranceAngleRunStairsForm.MiddleStairsWidth = middleStairsWidth;
						linearDoubleBranceAngleRunStairsForm.SaveData();
					}
				}
				else if (LinearDoubleBranceAngleRunStairsForm.MeasureType.MT_Angle == linearDoubleBranceAngleRunStairsForm.theMeasureType)
				{
					double rotateAngle = 0.0;
					if (this.GetAngle(ref rotateAngle))
					{
						linearDoubleBranceAngleRunStairsForm.RotateAngle = rotateAngle;
						linearDoubleBranceAngleRunStairsForm.SaveData();
					}
				}
			}
			if (DialogResult.Cancel == dialogResult)
			{
				return false;
			}
			double rotateAngle2 = linearDoubleBranceAngleRunStairsForm.RotateAngle;
			int insertPointIndex = linearDoubleBranceAngleRunStairsForm.GetInsertPointIndex();
			linearDoubleBranceAngleRunStairsForm.GetUpstairsLoc();
			bool noteInfo = linearDoubleBranceAngleRunStairsForm.GetNoteInfo();
			bool tbmirror = linearDoubleBranceAngleRunStairsForm.GetTBMirror();
			bool lrmirror = linearDoubleBranceAngleRunStairsForm.GetLRMirror();
			bool bottomBeam = linearDoubleBranceAngleRunStairsForm.GetBottomBeam();
			bool middleBeam = linearDoubleBranceAngleRunStairsForm.GetMiddleBeam();
			bool topBeam = linearDoubleBranceAngleRunStairsForm.GetTopBeam();
			this.m_StairsCreator = new DoubleBranceAngleStairsCreator(this.m_Revit);
			DoubleBranchAngleStairs doubleBranchAngleStairs = new DoubleBranchAngleStairs(this.m_StairsCreator);
			doubleBranchAngleStairs.m_dTopOffset = Common.MMToFeet(linearDoubleBranceAngleRunStairsForm.GetTopOffset());
			doubleBranchAngleStairs.m_dBottomOffset = Common.MMToFeet(linearDoubleBranceAngleRunStairsForm.BottomOffset);
			doubleBranchAngleStairs.m_LeftRunData = linearDoubleBranceAngleRunStairsForm.GetSideStairsData();
			doubleBranchAngleStairs.m_MidRunData = linearDoubleBranceAngleRunStairsForm.GetMiddleStairsData();
			doubleBranchAngleStairs.m_RightRunData = linearDoubleBranceAngleRunStairsForm.GetSideStairsData();
			doubleBranchAngleStairs.m_LandData = linearDoubleBranceAngleRunStairsForm.GetLandingData();
			doubleBranchAngleStairs.m_listSupport = linearDoubleBranceAngleRunStairsForm.GetSupportData();
			doubleBranchAngleStairs.m_listRail = linearDoubleBranceAngleRunStairsForm.GetRailingData();
			doubleBranchAngleStairs.m_BeamData = linearDoubleBranceAngleRunStairsForm.GetBeamData();
			doubleBranchAngleStairs.m_FloorType = linearDoubleBranceAngleRunStairsForm.GetFloorType();
			doubleBranchAngleStairs.m_arLandWidth = linearDoubleBranceAngleRunStairsForm.GetLandWidth();
			doubleBranchAngleStairs.m_dBottomElevation = linearDoubleBranceAngleRunStairsForm.GetBottomElevation();
			doubleBranchAngleStairs.m_dLevelValue = linearDoubleBranceAngleRunStairsForm.GetLevelValue();
			doubleBranchAngleStairs.m_bIsCenterUp = linearDoubleBranceAngleRunStairsForm.GetUpstairsLoc();
			doubleBranchAngleStairs.m_bNoteUpStairs = noteInfo;
			doubleBranchAngleStairs.m_sUsingRange = linearDoubleBranceAngleRunStairsForm.UsingRange;
			new DoubleBranchAngleStairsKit(this.m_Revit.Application.Application).DoubleBranchAngleStarisProfileCurves(ref doubleBranchAngleStairs, noteInfo, insertPointIndex, lrmirror, tbmirror, rotateAngle2, bottomBeam, middleBeam, topBeam);
			List<CurveInfo> list = new List<CurveInfo>();
			foreach (SingleRunCurveInfo singleRunCurveInfo in doubleBranchAngleStairs.m_listRunCurve)
			{
				list.AddRange(singleRunCurveInfo.RunBoundaryCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunRiserCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunPathCurvesInfoList);
			}
			list.AddRange(doubleBranchAngleStairs.m_listLandCurve.ElementAt(0).m_arCurveInfo);
			List<JigEdgeInfo> list2 = new List<JigEdgeInfo>();
			foreach (CurveInfo curveInfo in list)
			{
				if (!(null == curveInfo.CurveObj))
				{
					JigEdgeInfo item = new JigEdgeInfo(curveInfo.CurveObj);
					list2.Add(item);
				}
			}
			XYZ xyz = null;
			List<JigTextInfo> textInfos = new List<JigTextInfo>();
			if (!DragCurveJigInterface.GetInsertPosition(this.m_Revit, list2, false, textInfos, false, doubleBranchAngleStairs.m_ptPosition, ref xyz))
			{
				return false;
			}
			doubleBranchAngleStairs.m_ptRealInsert = xyz;
			doubleBranchAngleStairs.m_ptPosition = xyz - doubleBranchAngleStairs.m_ptPosition;
			Transform transform = RevitVersionFuncs.CreateTranslation(new XYZ(doubleBranchAngleStairs.m_ptPosition.X, doubleBranchAngleStairs.m_ptPosition.Y, 0.0));
			doubleBranchAngleStairs.m_Transform = transform.Multiply(doubleBranchAngleStairs.m_Transform);
			doubleBranchAngleStairs.TransFormRailPoints();
			doubleBranchAngleStairs.TransFormOutSupportPoints();
			doubleBranchAngleStairs.DrawStairs();
			return true;
		}

		public bool AddLinearDoubleBranchThreeRunStairs()
		{
			LinearDoubleBranceThreeRunStairsForm linearDoubleBranceThreeRunStairsForm = new LinearDoubleBranceThreeRunStairsForm(this.m_Revit);
			DialogResult dialogResult;
			while ((dialogResult = linearDoubleBranceThreeRunStairsForm.ShowDialog()) == DialogResult.OK && linearDoubleBranceThreeRunStairsForm.theMeasureType != LinearDoubleBranceThreeRunStairsForm.MeasureType.MT_None)
			{
				if (LinearDoubleBranceThreeRunStairsForm.MeasureType.MT_SideWidth == linearDoubleBranceThreeRunStairsForm.theMeasureType)
				{
					double sideStairsWidth = 0.0;
					if (this.GetLength("边梯段宽", ref sideStairsWidth))
					{
						linearDoubleBranceThreeRunStairsForm.SideStairsWidth = sideStairsWidth;
						linearDoubleBranceThreeRunStairsForm.SaveData();
					}
				}
				else if (LinearDoubleBranceThreeRunStairsForm.MeasureType.MT_MiddleWidth == linearDoubleBranceThreeRunStairsForm.theMeasureType)
				{
					double middleStairsWidth = 0.0;
					if (this.GetLength("中梯段宽", ref middleStairsWidth))
					{
						linearDoubleBranceThreeRunStairsForm.MiddleStairsWidth = middleStairsWidth;
						linearDoubleBranceThreeRunStairsForm.SaveData();
					}
				}
				else if (LinearDoubleBranceThreeRunStairsForm.MeasureType.MT_TwoRunWidth == linearDoubleBranceThreeRunStairsForm.theMeasureType)
				{
					double twoRunStairsWidth = 0.0;
					if (this.GetLength("二跑段宽", ref twoRunStairsWidth))
					{
						linearDoubleBranceThreeRunStairsForm.TwoRunStairsWidth = twoRunStairsWidth;
						linearDoubleBranceThreeRunStairsForm.SaveData();
					}
				}
				else if (LinearDoubleBranceThreeRunStairsForm.MeasureType.MT_Angle == linearDoubleBranceThreeRunStairsForm.theMeasureType)
				{
					double rotateAngle = 0.0;
					if (this.GetAngle(ref rotateAngle))
					{
						linearDoubleBranceThreeRunStairsForm.RotateAngle = rotateAngle;
						linearDoubleBranceThreeRunStairsForm.SaveData();
					}
				}
			}
			if (DialogResult.Cancel == dialogResult)
			{
				return false;
			}
			double rotateAngle2 = linearDoubleBranceThreeRunStairsForm.RotateAngle;
			int insertPointIndex = linearDoubleBranceThreeRunStairsForm.GetInsertPointIndex();
			linearDoubleBranceThreeRunStairsForm.GetUpstairsLoc();
			bool noteInfo = linearDoubleBranceThreeRunStairsForm.GetNoteInfo();
			bool tbmirror = linearDoubleBranceThreeRunStairsForm.GetTBMirror();
			bool lrmirror = linearDoubleBranceThreeRunStairsForm.GetLRMirror();
			bool bottomBeam = linearDoubleBranceThreeRunStairsForm.GetBottomBeam();
			bool middleBeam = linearDoubleBranceThreeRunStairsForm.GetMiddleBeam();
			bool topBeam = linearDoubleBranceThreeRunStairsForm.GetTopBeam();
			this.m_StairsCreator = new DoubleBranceThreeRunStairsCreator(this.m_Revit);
			DoubleBranchThreeRunStairs doubleBranchThreeRunStairs = new DoubleBranchThreeRunStairs(this.m_StairsCreator);
			doubleBranchThreeRunStairs.m_dTopOffset = Common.MMToFeet(linearDoubleBranceThreeRunStairsForm.GetTopOffset());
			doubleBranchThreeRunStairs.m_dBottomOffset = Common.MMToFeet(linearDoubleBranceThreeRunStairsForm.BottomOffset);
			doubleBranchThreeRunStairs.m_LeftRunData = linearDoubleBranceThreeRunStairsForm.GetSideStairsData();
			doubleBranchThreeRunStairs.m_MidRunData = linearDoubleBranceThreeRunStairsForm.GetMiddleStairsData();
			doubleBranchThreeRunStairs.m_RightRunData = linearDoubleBranceThreeRunStairsForm.GetSideStairsData();
			doubleBranchThreeRunStairs.m_TwoRunLeftData = linearDoubleBranceThreeRunStairsForm.GetTwoRunStairsData();
			doubleBranchThreeRunStairs.m_TwoRunRightData = linearDoubleBranceThreeRunStairsForm.GetTwoRunStairsData();
			doubleBranchThreeRunStairs.m_SideLandData = linearDoubleBranceThreeRunStairsForm.GetSideLandingData();
			doubleBranchThreeRunStairs.m_MiddleLandData = linearDoubleBranceThreeRunStairsForm.GetMiddleLandingData();
			doubleBranchThreeRunStairs.m_listSupport = linearDoubleBranceThreeRunStairsForm.GetSupportData();
			doubleBranchThreeRunStairs.m_listRail = linearDoubleBranceThreeRunStairsForm.GetRailingData();
			doubleBranchThreeRunStairs.m_BeamData = linearDoubleBranceThreeRunStairsForm.GetBeamData();
			doubleBranchThreeRunStairs.m_FloorType = linearDoubleBranceThreeRunStairsForm.GetFloorType();
			doubleBranchThreeRunStairs.m_arLandWidth = linearDoubleBranceThreeRunStairsForm.GetLandWidth();
			doubleBranchThreeRunStairs.m_dBottomElevation = linearDoubleBranceThreeRunStairsForm.GetBottomElevation();
			doubleBranchThreeRunStairs.m_dLevelValue = linearDoubleBranceThreeRunStairsForm.GetLevelValue();
			doubleBranchThreeRunStairs.m_bIsCenterUp = linearDoubleBranceThreeRunStairsForm.GetUpstairsLoc();
			doubleBranchThreeRunStairs.m_bNoteUpStairs = noteInfo;
			doubleBranchThreeRunStairs.m_sUsingRange = linearDoubleBranceThreeRunStairsForm.UsingRange;
			new DoubleBranceThreeRunStairsKit(this.m_Revit.Application.Application).DoubleBranchThreeRunStairsProfileCurves(ref doubleBranchThreeRunStairs, noteInfo, insertPointIndex, lrmirror, tbmirror, rotateAngle2, bottomBeam, middleBeam, topBeam);
			List<CurveInfo> list = new List<CurveInfo>();
			foreach (SingleRunCurveInfo singleRunCurveInfo in doubleBranchThreeRunStairs.m_listRunCurve)
			{
				list.AddRange(singleRunCurveInfo.RunBoundaryCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunRiserCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunPathCurvesInfoList);
			}
			foreach (LandingCurveInfo landingCurveInfo in doubleBranchThreeRunStairs.m_listLandCurve)
			{
				list.AddRange(landingCurveInfo.m_arCurveInfo);
			}
			List<JigEdgeInfo> list2 = new List<JigEdgeInfo>();
			foreach (CurveInfo curveInfo in list)
			{
				if (!(null == curveInfo.CurveObj))
				{
					JigEdgeInfo item = new JigEdgeInfo(curveInfo.CurveObj);
					list2.Add(item);
				}
			}
			XYZ xyz = null;
			List<JigTextInfo> textInfos = new List<JigTextInfo>();
			if (!DragCurveJigInterface.GetInsertPosition(this.m_Revit, list2, false, textInfos, false, doubleBranchThreeRunStairs.m_ptPosition, ref xyz))
			{
				return false;
			}
			doubleBranchThreeRunStairs.m_ptRealInsert = xyz;
			doubleBranchThreeRunStairs.m_ptPosition = xyz - doubleBranchThreeRunStairs.m_ptPosition;
			Transform transform = RevitVersionFuncs.CreateTranslation(new XYZ(doubleBranchThreeRunStairs.m_ptPosition.X, doubleBranchThreeRunStairs.m_ptPosition.Y, 0.0));
			doubleBranchThreeRunStairs.m_Transform = transform.Multiply(doubleBranchThreeRunStairs.m_Transform);
			doubleBranchThreeRunStairs.TransFormRailPoints();
			doubleBranchThreeRunStairs.TransFormOutSupportPoints();
			doubleBranchThreeRunStairs.DrawStairs();
			return true;
		}

		public bool AddTrigonStairs()
		{
			TrigonStairsForm trigonStairsForm = new TrigonStairsForm(this.m_Revit);
			DialogResult dialogResult;
			while ((dialogResult = trigonStairsForm.ShowDialog()) == DialogResult.OK && trigonStairsForm.theMeasureType != TrigonStairsForm.MeasureType.MT_None)
			{
				if (TrigonStairsForm.MeasureType.MT_StairsWidth == trigonStairsForm.theMeasureType)
				{
					double stairsWidth = 0.0;
					if (this.GetLength("梯段宽度", ref stairsWidth))
					{
						trigonStairsForm.StairsWidth = stairsWidth;
						trigonStairsForm.SaveData();
					}
				}
				else if (TrigonStairsForm.MeasureType.MT_Angle == trigonStairsForm.theMeasureType)
				{
					double rotateAngle = 0.0;
					if (this.GetAngle(ref rotateAngle))
					{
						trigonStairsForm.RotateAngle = rotateAngle;
						trigonStairsForm.SaveData();
					}
				}
			}
			if (DialogResult.Cancel == dialogResult)
			{
				return false;
			}
			bool result = true;
			double rotateAngle2 = trigonStairsForm.RotateAngle;
			int insertPointIndex = trigonStairsForm.GetInsertPointIndex();
			bool noteInfo = trigonStairsForm.GetNoteInfo();
			bool tbmirror = trigonStairsForm.GetTBMirror();
			bool lrmirror = trigonStairsForm.GetLRMirror();
			bool bottomBeam = trigonStairsForm.GetBottomBeam();
			bool middleBeam = trigonStairsForm.GetMiddleBeam();
			bool landBeam = trigonStairsForm.GetLandBeam();
			bool topBeam = trigonStairsForm.GetTopBeam();
			bool upstairs = trigonStairsForm.GetUpstairs();
			this.m_StairsCreator = new TrigonStairsCreator(this.m_Revit);
			TrigonStairs trigonStairs = new TrigonStairs(this.m_StairsCreator);
			trigonStairs.m_dTopOffset = Common.MMToFeet(trigonStairsForm.GetTopOffset());
			trigonStairs.m_dBottomOffset = Common.MMToFeet(trigonStairsForm.BottomOffset);
			trigonStairs.m_dWellWidth = trigonStairsForm.GetWellWidth();
			trigonStairs.m_BottomRunData = trigonStairsForm.GetBottomStairsData();
			trigonStairs.m_MidRunData = trigonStairsForm.GetMiddleStairsData();
			trigonStairs.m_TopRunData = trigonStairsForm.GetTopStairsData();
			trigonStairs.m_LandData = trigonStairsForm.GetLandingData();
			trigonStairs.m_listSupport = trigonStairsForm.GetSupportData();
			trigonStairs.m_listRail = trigonStairsForm.GetRailingData();
			trigonStairs.m_BeamData = trigonStairsForm.GetBeamData();
			trigonStairs.m_FloorType = trigonStairsForm.GetFloorType();
			trigonStairs.m_arLandWidth = trigonStairsForm.GetLandWidth();
			trigonStairs.m_dBottomElevation = trigonStairsForm.GetBottomElevation();
			trigonStairs.m_dLevelValue = trigonStairsForm.GetLevelValue();
			trigonStairs.m_bNoteUpStairs = noteInfo;
			trigonStairs.m_sUsingRange = trigonStairsForm.UsingRange;
			if (!upstairs)
			{
				double bottomElevation = trigonStairs.m_TopRunData.BottomElevation;
				trigonStairs.m_TopRunData.BottomElevation = trigonStairs.m_BottomRunData.BottomElevation;
				trigonStairs.m_BottomRunData.BottomElevation = bottomElevation;
			}
			new TrigonStairsKit(this.m_Revit.Application.Application).TrigonStairsProfileCurves(ref trigonStairs, noteInfo, insertPointIndex, lrmirror, tbmirror, upstairs, rotateAngle2, bottomBeam, middleBeam, landBeam, topBeam);
			List<CurveInfo> list = new List<CurveInfo>();
			foreach (SingleRunCurveInfo singleRunCurveInfo in trigonStairs.m_listRunCurve)
			{
				list.AddRange(singleRunCurveInfo.RunBoundaryCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunRiserCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunPathCurvesInfoList);
			}
			foreach (LandingCurveInfo landingCurveInfo in trigonStairs.m_listLandCurve)
			{
				list.AddRange(landingCurveInfo.m_arCurveInfo);
			}
			List<JigEdgeInfo> list2 = new List<JigEdgeInfo>();
			foreach (CurveInfo curveInfo in list)
			{
				if (!(null == curveInfo.CurveObj))
				{
					JigEdgeInfo item = new JigEdgeInfo(curveInfo.CurveObj);
					list2.Add(item);
				}
			}
			XYZ xyz = null;
			List<JigTextInfo> textInfos = new List<JigTextInfo>();
			if (!DragCurveJigInterface.GetInsertPosition(this.m_Revit, list2, false, textInfos, false, trigonStairs.m_TransVector, ref xyz))
			{
				return false;
			}
			trigonStairs.m_ptRealInsert = xyz;
			trigonStairs.m_TransVector = xyz - trigonStairs.m_TransVector;
			Transform transform = RevitVersionFuncs.CreateTranslation(new XYZ(trigonStairs.m_TransVector.X, trigonStairs.m_TransVector.Y, 0.0));
			trigonStairs.m_Transform = transform.Multiply(trigonStairs.m_Transform);
			trigonStairs.TransFormRailPoints();
			trigonStairs.TransFormOutSupportPoints();
			trigonStairs.DrawStairs();
			return result;
		}

		public bool AddRectangleAngleStairs()
		{
			RectangleAngleStairsForm rectangleAngleStairsForm = new RectangleAngleStairsForm(this.m_Revit);
			DialogResult dialogResult;
			while ((dialogResult = rectangleAngleStairsForm.ShowDialog()) == DialogResult.OK && rectangleAngleStairsForm.theMeasureType != RectangleAngleStairsForm.MeasureType.MT_None)
			{
				if (RectangleAngleStairsForm.MeasureType.MT_StairsWidth == rectangleAngleStairsForm.theMeasureType)
				{
					double stairsWidth = 0.0;
					if (this.GetLength("梯间宽度", ref stairsWidth))
					{
						rectangleAngleStairsForm.StairsWidth = stairsWidth;
						rectangleAngleStairsForm.SaveData();
					}
				}
				else if (RectangleAngleStairsForm.MeasureType.MT_StairsLength == rectangleAngleStairsForm.theMeasureType)
				{
					double stairsLength = 0.0;
					if (this.GetLength("梯间长度", ref stairsLength))
					{
						rectangleAngleStairsForm.StairsLength = stairsLength;
						rectangleAngleStairsForm.SaveData();
					}
				}
				else if (RectangleAngleStairsForm.MeasureType.MT_OneRunWidth == rectangleAngleStairsForm.theMeasureType)
				{
					double oneRunWidth = 0.0;
					if (this.GetLength("一跑宽度", ref oneRunWidth))
					{
						rectangleAngleStairsForm.OneRunWidth = oneRunWidth;
						rectangleAngleStairsForm.SaveData();
					}
				}
				else if (RectangleAngleStairsForm.MeasureType.MT_TwoRunWidth == rectangleAngleStairsForm.theMeasureType)
				{
					double twoRunWidth = 0.0;
					if (this.GetLength("二跑宽度", ref twoRunWidth))
					{
						rectangleAngleStairsForm.TwoRunWidth = twoRunWidth;
						rectangleAngleStairsForm.SaveData();
					}
				}
				else if (RectangleAngleStairsForm.MeasureType.MT_ThreeRunWidth == rectangleAngleStairsForm.theMeasureType)
				{
					double threeRunWidth = 0.0;
					if (this.GetLength("三跑宽度", ref threeRunWidth))
					{
						rectangleAngleStairsForm.ThreeRunWidth = threeRunWidth;
						rectangleAngleStairsForm.SaveData();
					}
				}
				else if (RectangleAngleStairsForm.MeasureType.MT_FourRunWidth == rectangleAngleStairsForm.theMeasureType)
				{
					double fourRunWidth = 0.0;
					if (this.GetLength("四跑宽度", ref fourRunWidth))
					{
						rectangleAngleStairsForm.FourRunWidth = fourRunWidth;
						rectangleAngleStairsForm.SaveData();
					}
				}
				else if (RectangleAngleStairsForm.MeasureType.MT_Angle == rectangleAngleStairsForm.theMeasureType)
				{
					double rotateAngle = 0.0;
					if (this.GetAngle(ref rotateAngle))
					{
						rectangleAngleStairsForm.RotateAngle = rotateAngle;
						rectangleAngleStairsForm.SaveData();
					}
				}
			}
			if (DialogResult.Cancel == dialogResult)
			{
				return false;
			}
			bool result = true;
			double rotateAngle2 = rectangleAngleStairsForm.RotateAngle;
			int insertPointIndex = rectangleAngleStairsForm.GetInsertPointIndex();
			bool noteInfo = rectangleAngleStairsForm.GetNoteInfo();
			bool tbmirror = rectangleAngleStairsForm.GetTBMirror();
			bool lrmirror = rectangleAngleStairsForm.GetLRMirror();
			bool middleBeam = rectangleAngleStairsForm.GetMiddleBeam();
			bool landBeam = rectangleAngleStairsForm.GetLandBeam();
			bool upstairs = rectangleAngleStairsForm.GetUpstairs();
			this.m_StairsCreator = new RectangleAngleStairsCreator(this.m_Revit);
			RectangleAngleStairs rectangleAngleStairs = new RectangleAngleStairs(this.m_StairsCreator);
			rectangleAngleStairs.m_dTopOffset = Common.MMToFeet(rectangleAngleStairsForm.GetTopOffset());
			rectangleAngleStairs.m_dBottomOffset = Common.MMToFeet(rectangleAngleStairsForm.BottomOffset);
			rectangleAngleStairs.m_dStairsLength = Common.MMToFeet(rectangleAngleStairsForm.StairsLength);
			rectangleAngleStairs.m_dStairsWidth = Common.MMToFeet(rectangleAngleStairsForm.StairsWidth);
			rectangleAngleStairs.m_listSupport = rectangleAngleStairsForm.GetSupportData();
			rectangleAngleStairs.m_listRail = rectangleAngleStairsForm.GetRailingData();
			rectangleAngleStairs.m_BeamData = rectangleAngleStairsForm.GetBeamData();
			rectangleAngleStairs.m_FloorType = rectangleAngleStairsForm.GetFloorType();
			rectangleAngleStairs.m_arLandWidth = rectangleAngleStairsForm.GetLandWidth();
			rectangleAngleStairs.m_dBottomElevation = rectangleAngleStairsForm.GetBottomElevation();
			rectangleAngleStairs.m_dLevelValue = rectangleAngleStairsForm.GetLevelValue();
			rectangleAngleStairs.m_nRunCount = rectangleAngleStairsForm.GetRunCount();
			rectangleAngleStairs.m_bNoteUpStairs = noteInfo;
			rectangleAngleStairs.m_sUsingRange = rectangleAngleStairsForm.UsingRange;
			rectangleAngleStairs.m_LandingThickness = Common.MMToFeet((double)rectangleAngleStairsForm.LandingThickness);
			if (2 == rectangleAngleStairs.m_nRunCount)
			{
				rectangleAngleStairs.m_listRunData.Add(rectangleAngleStairsForm.GetOneRunData());
				rectangleAngleStairs.m_listRunData.Add(rectangleAngleStairsForm.GetTwoRunData());
			}
			else if (3 == rectangleAngleStairs.m_nRunCount)
			{
				rectangleAngleStairs.m_listRunData.Add(rectangleAngleStairsForm.GetOneRunData());
				rectangleAngleStairs.m_listRunData.Add(rectangleAngleStairsForm.GetTwoRunData());
				rectangleAngleStairs.m_listRunData.Add(rectangleAngleStairsForm.GetThreeRunData());
			}
			else if (4 == rectangleAngleStairs.m_nRunCount)
			{
				rectangleAngleStairs.m_listRunData.Add(rectangleAngleStairsForm.GetOneRunData());
				rectangleAngleStairs.m_listRunData.Add(rectangleAngleStairsForm.GetTwoRunData());
				rectangleAngleStairs.m_listRunData.Add(rectangleAngleStairsForm.GetThreeRunData());
				rectangleAngleStairs.m_listRunData.Add(rectangleAngleStairsForm.GetFourRunData());
			}
			new RectangleAngleStairsKit(this.m_Revit.Application.Application).RectangleAngleStairsProfileCurves(ref rectangleAngleStairs, noteInfo, insertPointIndex, lrmirror, tbmirror, upstairs, rotateAngle2, false, middleBeam, landBeam, false);
			List<CurveInfo> list = new List<CurveInfo>();
			foreach (SingleRunCurveInfo singleRunCurveInfo in rectangleAngleStairs.m_listRunCurve)
			{
				list.AddRange(singleRunCurveInfo.RunBoundaryCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunRiserCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunPathCurvesInfoList);
			}
			foreach (LandingCurveInfo landingCurveInfo in rectangleAngleStairs.m_listLandCurve)
			{
				list.AddRange(landingCurveInfo.m_arCurveInfo);
			}
			List<JigEdgeInfo> list2 = new List<JigEdgeInfo>();
			foreach (CurveInfo curveInfo in list)
			{
				if (!(null == curveInfo.CurveObj))
				{
					JigEdgeInfo item = new JigEdgeInfo(curveInfo.CurveObj);
					list2.Add(item);
				}
			}
			XYZ xyz = null;
			List<JigTextInfo> textInfos = new List<JigTextInfo>();
			if (!DragCurveJigInterface.GetInsertPosition(this.m_Revit, list2, false, textInfos, false, rectangleAngleStairs.m_TransVector, ref xyz))
			{
				return false;
			}
			rectangleAngleStairs.m_ptRealInsert = xyz;
			rectangleAngleStairs.m_TransVector = xyz - rectangleAngleStairs.m_TransVector;
			Transform transform = RevitVersionFuncs.CreateTranslation(new XYZ(rectangleAngleStairs.m_TransVector.X, rectangleAngleStairs.m_TransVector.Y, 0.0));
			rectangleAngleStairs.m_Transform = transform.Multiply(rectangleAngleStairs.m_Transform);
			rectangleAngleStairs.TransFormRailPoints();
			rectangleAngleStairs.TransFormOutSupportPoints();
			rectangleAngleStairs.DrawStairs();
			return result;
		}

		private void SetClilpperStairsRailing(bool bInner, bool bOuter, ClipperStairsForm dlg, ref ClipperStairs Stairs)
		{
			if (bOuter)
			{
				double outerRailHeight = dlg.GetOuterRailHeight();
				RailingType outerRailType = dlg.GetOuterRailType();
				BaseRaillingData baseRaillingData = new BaseRaillingData();
				baseRaillingData.m_ptStart = Stairs.m_LeftRunData.PtRunBottomLeft;
				baseRaillingData.TheRailingType = outerRailType;
				baseRaillingData.RailingHeight = outerRailHeight;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.m_ptStart = Stairs.m_LeftRunData.PtRunTopLeft;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.TheRailingType = outerRailType;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.m_ptStart = Stairs.m_RightRunData.PtRunTopRight;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.TheRailingType = outerRailType;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.m_ptStart = Stairs.m_RightRunData.PtRunBottomRight;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.TheRailingType = outerRailType;
				Stairs.m_listRail.Add(baseRaillingData);
			}
			if (bInner)
			{
				double innerRailHeight = dlg.GetInnerRailHeight();
				RailingType innerRailType = dlg.GetInnerRailType();
				BaseRaillingData baseRaillingData2 = new BaseRaillingData();
				baseRaillingData2.m_ptStart = Stairs.m_LeftRunData.PtRunBottomRight;
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.TheRailingType = innerRailType;
				Stairs.m_listRail.Add(baseRaillingData2);
				baseRaillingData2 = new BaseRaillingData();
				baseRaillingData2.m_ptStart = Stairs.m_LeftRunData.PtRunTopRight;
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.TheRailingType = innerRailType;
				Stairs.m_listRail.Add(baseRaillingData2);
				baseRaillingData2 = new BaseRaillingData();
				baseRaillingData2.m_ptStart = Stairs.m_RightRunData.PtRunBottomLeft;
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.TheRailingType = innerRailType;
				Stairs.m_listRail.Add(baseRaillingData2);
				baseRaillingData2 = new BaseRaillingData();
				baseRaillingData2.m_ptStart = Stairs.m_RightRunData.PtRunTopLeft;
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.TheRailingType = innerRailType;
				Stairs.m_listRail.Add(baseRaillingData2);
			}
		}

		public bool AddClipperStairs()
		{
			ClipperStairsForm clipperStairsForm = new ClipperStairsForm(this.m_Revit);
			DialogResult dialogResult;
			while ((dialogResult = clipperStairsForm.ShowDialog()) == DialogResult.OK && clipperStairsForm.theMeasureType != ClipperStairsForm.MeasureType.MT_None)
			{
				if (ClipperStairsForm.MeasureType.MT_StairsWidth == clipperStairsForm.theMeasureType)
				{
					double stairsWidth = 0.0;
					if (this.GetLength("梯间宽度", ref stairsWidth))
					{
						clipperStairsForm.StairsWidth = stairsWidth;
						clipperStairsForm.SaveData();
					}
				}
				else if (ClipperStairsForm.MeasureType.MT_RunWidth == clipperStairsForm.theMeasureType)
				{
					double stairsRunWidth = 0.0;
					if (this.GetLength("梯段宽度", ref stairsRunWidth))
					{
						clipperStairsForm.StairsRunWidth = stairsRunWidth;
						clipperStairsForm.SaveData();
					}
				}
				else if (ClipperStairsForm.MeasureType.MT_Angle == clipperStairsForm.theMeasureType)
				{
					double rotateAngle = 0.0;
					if (this.GetAngle(ref rotateAngle))
					{
						clipperStairsForm.RotateAngle = rotateAngle;
						clipperStairsForm.SaveData();
					}
				}
				else if (ClipperStairsForm.MeasureType.MT_RunLength == clipperStairsForm.theMeasureType)
				{
					double stairsRunLength = 0.0;
					if (this.GetLength("梯段长度", ref stairsRunLength))
					{
						clipperStairsForm.StairsRunLength = stairsRunLength;
						clipperStairsForm.SaveData();
					}
				}
			}
			if (DialogResult.Cancel == dialogResult)
			{
				return false;
			}
			double rotateAngle2 = clipperStairsForm.RotateAngle;
			int insertPointIndex = clipperStairsForm.GetInsertPointIndex();
			bool upstairsLoc = clipperStairsForm.GetUpstairsLoc();
			bool noteInfo = clipperStairsForm.GetNoteInfo();
			bool tbmirror = clipperStairsForm.GetTBMirror();
			bool lrmirror = clipperStairsForm.GetLRMirror();
			bool bottomBeam = clipperStairsForm.GetBottomBeam();
			bool midBeam = clipperStairsForm.GetMidBeam();
			bool outerRail = clipperStairsForm.GetOuterRail();
			bool innerRail = clipperStairsForm.GetInnerRail();
			this.m_StairsCreator = new ClipperStairsCreator(this.m_Revit);
			ClipperStairs clipperStairs = new ClipperStairs(this.m_StairsCreator);
			clipperStairs.m_dTopOffset = Common.MMToFeet(clipperStairsForm.GetTopOffset());
			clipperStairs.m_dBottomOffset = Common.MMToFeet(clipperStairsForm.BottomOffset);
			clipperStairs.m_dStairsWidth = Common.MMToFeet(clipperStairsForm.StairsWidth);
			clipperStairs.m_LeftRunData = clipperStairsForm.GetStairsRunData();
			clipperStairs.m_RightRunData = clipperStairsForm.GetStairsRunData();
			clipperStairs.m_LandData = clipperStairsForm.GetLandingData();
			clipperStairs.m_listSupport = clipperStairsForm.GetSupportData();
			clipperStairs.m_BeamData = clipperStairsForm.GetBeamData();
			clipperStairs.m_FloorType = clipperStairsForm.GetFloorType();
			clipperStairs.m_arLandWidth = clipperStairsForm.GetLandWidth();
			clipperStairs.m_dBottomElevation = clipperStairsForm.GetBottomElevation();
			clipperStairs.m_dLevelValue = clipperStairsForm.GetLevelValue();
			clipperStairs.m_bNoteUpStairs = noteInfo;
			clipperStairs.m_sUsingRange = clipperStairsForm.UsingRange;
			new ClipperStairsKit(this.m_Revit.Application.Application).ClipperStairsProfileCurves(ref clipperStairs, noteInfo, insertPointIndex, lrmirror, tbmirror, upstairsLoc, rotateAngle2, bottomBeam, midBeam);
			this.SetClilpperStairsRailing(innerRail, outerRail, clipperStairsForm, ref clipperStairs);
			List<CurveInfo> list = new List<CurveInfo>();
			foreach (SingleRunCurveInfo singleRunCurveInfo in clipperStairs.m_listRunCurve)
			{
				list.AddRange(singleRunCurveInfo.RunBoundaryCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunRiserCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunPathCurvesInfoList);
			}
			foreach (LandingCurveInfo landingCurveInfo in clipperStairs.m_listLandCurve)
			{
				list.AddRange(landingCurveInfo.m_arCurveInfo);
			}
			List<JigEdgeInfo> list2 = new List<JigEdgeInfo>();
			foreach (CurveInfo curveInfo in list)
			{
				if (!(null == curveInfo.CurveObj))
				{
					JigEdgeInfo item = new JigEdgeInfo(curveInfo.CurveObj);
					list2.Add(item);
				}
			}
			XYZ xyz = null;
			List<JigTextInfo> textInfos = new List<JigTextInfo>();
			if (!DragCurveJigInterface.GetInsertPosition(this.m_Revit, list2, false, textInfos, false, clipperStairs.m_TransVector, ref xyz))
			{
				return false;
			}
			clipperStairs.m_ptRealInsert = xyz;
			clipperStairs.m_TransVector = xyz - clipperStairs.m_TransVector;
			Transform transform = RevitVersionFuncs.CreateTranslation(new XYZ(clipperStairs.m_TransVector.X, clipperStairs.m_TransVector.Y, 0.0));
			clipperStairs.m_Transform = transform.Multiply(clipperStairs.m_Transform);
			clipperStairs.TransFormRailPoints();
			clipperStairs.TransFormOutSupportPoints();
			clipperStairs.DrawStairs();
			return true;
		}

		private void SetCrossingStairsRailing(bool bInner, bool bOuter, CrossingStairsForm dlg, ref CrossingStairs Stairs)
		{
			BaseRaillingData baseRaillingData = new BaseRaillingData();
			if (bOuter)
			{
				double outerRailHeight = dlg.GetOuterRailHeight();
				RailingType outerRailType = dlg.GetOuterRailType();
				baseRaillingData.TheRailingType = outerRailType;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_LeftDownRunData.PtRunBottomLeft;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = outerRailType;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_LeftDownRunData.PtRunTopLeft;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = outerRailType;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_RightDownRunData.PtRunBottomRight;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = outerRailType;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_RightDownRunData.PtRunTopRight;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = outerRailType;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_LeftUpRunData.PtRunBottomLeft;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = outerRailType;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_LeftUpRunData.PtRunTopLeft;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = outerRailType;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_RightUpRunData.PtRunBottomRight;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = outerRailType;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_RightUpRunData.PtRunTopRight;
				Stairs.m_listRail.Add(baseRaillingData);
			}
			if (bInner)
			{
				double innerRailHeight = dlg.GetInnerRailHeight();
				RailingType innerRailType = dlg.GetInnerRailType();
				baseRaillingData.TheRailingType = innerRailType;
				baseRaillingData.RailingHeight = innerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_LeftDownRunData.PtRunBottomRight;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = innerRailType;
				baseRaillingData.RailingHeight = innerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_LeftDownRunData.PtRunTopRight;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = innerRailType;
				baseRaillingData.RailingHeight = innerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_RightDownRunData.PtRunBottomLeft;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = innerRailType;
				baseRaillingData.RailingHeight = innerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_RightDownRunData.PtRunTopLeft;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = innerRailType;
				baseRaillingData.RailingHeight = innerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_LeftUpRunData.PtRunBottomRight;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = innerRailType;
				baseRaillingData.RailingHeight = innerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_LeftUpRunData.PtRunTopRight;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = innerRailType;
				baseRaillingData.RailingHeight = innerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_RightUpRunData.PtRunBottomLeft;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = innerRailType;
				baseRaillingData.RailingHeight = innerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_RightUpRunData.PtRunTopLeft;
				Stairs.m_listRail.Add(baseRaillingData);
			}
		}

		public bool AddCrossingStairs()
		{
			CrossingStairsForm crossingStairsForm = new CrossingStairsForm(this.m_Revit);
			DialogResult dialogResult;
			while ((dialogResult = crossingStairsForm.ShowDialog()) == DialogResult.OK && crossingStairsForm.theMeasureType != CrossingStairsForm.MeasureType.MT_None)
			{
				if (CrossingStairsForm.MeasureType.MT_StairsWidth == crossingStairsForm.theMeasureType)
				{
					double stairsWidth = 0.0;
					if (this.GetLength("梯间宽度", ref stairsWidth))
					{
						crossingStairsForm.StairsWidth = stairsWidth;
						crossingStairsForm.SaveData();
					}
				}
				else if (CrossingStairsForm.MeasureType.MT_RunWidth == crossingStairsForm.theMeasureType)
				{
					double runWidth = 0.0;
					if (this.GetLength("梯段宽度", ref runWidth))
					{
						crossingStairsForm.RunWidth = runWidth;
						crossingStairsForm.SaveData();
					}
				}
				else if (CrossingStairsForm.MeasureType.MT_Angle == crossingStairsForm.theMeasureType)
				{
					double rotateAngle = 0.0;
					if (this.GetAngle(ref rotateAngle))
					{
						crossingStairsForm.RotateAngle = rotateAngle;
						crossingStairsForm.SaveData();
					}
				}
			}
			if (DialogResult.Cancel == dialogResult)
			{
				return false;
			}
			bool result = true;
			double rotateAngle2 = crossingStairsForm.RotateAngle;
			int insertPointIndex = crossingStairsForm.GetInsertPointIndex();
			int treadAlignType = crossingStairsForm.GetTreadAlignType();
			bool noteInfo = crossingStairsForm.GetNoteInfo();
			bool tbmirror = crossingStairsForm.GetTBMirror();
			bool lrmirror = crossingStairsForm.GetLRMirror();
			bool middleBeam = crossingStairsForm.GetMiddleBeam();
			bool upstairs = crossingStairsForm.GetUpstairs();
			bool innerRail = crossingStairsForm.GetInnerRail();
			bool outerRail = crossingStairsForm.GetOuterRail();
			this.m_StairsCreator = new CrossingStairsCreator(this.m_Revit);
			CrossingStairs crossingStairs = new CrossingStairs(this.m_StairsCreator);
			crossingStairs.m_dTopOffset = Common.MMToFeet(crossingStairsForm.GetTopOffset());
			crossingStairs.m_dBottomOffset = Common.MMToFeet(crossingStairsForm.BottomOffset);
			crossingStairs.m_dStairsWidth = Common.MMToFeet(crossingStairsForm.StairsWidth);
			crossingStairs.m_LeftUpRunData = crossingStairsForm.GetLeftUpRunData();
			crossingStairs.m_LeftDownRunData = crossingStairsForm.GetLeftDownRunData();
			crossingStairs.m_RightUpRunData = crossingStairsForm.GetRightUpRunData();
			crossingStairs.m_RightDownRunData = crossingStairsForm.GetRightDownRunData();
			crossingStairs.m_LandData = crossingStairsForm.GetLandingData();
			crossingStairs.m_listSupport = crossingStairsForm.GetSupportData();
			crossingStairs.m_BeamData = crossingStairsForm.GetBeamData();
			crossingStairs.m_FloorType = crossingStairsForm.GetFloorType();
			crossingStairs.m_arLandWidth = crossingStairsForm.GetLandWidth();
			crossingStairs.m_dBottomElevation = crossingStairsForm.GetBottomElevation();
			crossingStairs.m_dLevelValue = crossingStairsForm.GetLevelValue();
			crossingStairs.m_bNoteUpStairs = noteInfo;
			crossingStairs.m_sUsingRange = crossingStairsForm.UsingRange;
			new CrossingStairsKit(this.m_Revit.Application.Application).CrossingStairsProfileCurves(ref crossingStairs, noteInfo, treadAlignType, insertPointIndex, lrmirror, tbmirror, upstairs, rotateAngle2, middleBeam);
			this.SetCrossingStairsRailing(innerRail, outerRail, crossingStairsForm, ref crossingStairs);
			List<CurveInfo> list = new List<CurveInfo>();
			foreach (SingleRunCurveInfo singleRunCurveInfo in crossingStairs.m_listRunCurve)
			{
				list.AddRange(singleRunCurveInfo.RunBoundaryCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunRiserCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunPathCurvesInfoList);
			}
			foreach (LandingCurveInfo landingCurveInfo in crossingStairs.m_listLandCurve)
			{
				list.AddRange(landingCurveInfo.m_arCurveInfo);
			}
			List<JigEdgeInfo> list2 = new List<JigEdgeInfo>();
			foreach (CurveInfo curveInfo in list)
			{
				if (!(null == curveInfo.CurveObj))
				{
					JigEdgeInfo item = new JigEdgeInfo(curveInfo.CurveObj);
					list2.Add(item);
				}
			}
			XYZ xyz = null;
			List<JigTextInfo> textInfos = new List<JigTextInfo>();
			if (!DragCurveJigInterface.GetInsertPosition(this.m_Revit, list2, false, textInfos, false, crossingStairs.m_TransVector, ref xyz))
			{
				return false;
			}
			crossingStairs.m_ptRealInsert = xyz;
			crossingStairs.m_TransVector = xyz - crossingStairs.m_TransVector;
			Transform transform = RevitVersionFuncs.CreateTranslation(new XYZ(crossingStairs.m_TransVector.X, crossingStairs.m_TransVector.Y, 0.0));
			crossingStairs.m_Transform = transform.Multiply(crossingStairs.m_Transform);
			crossingStairs.TransFormRailPoints();
			crossingStairs.TransFormOutSupportPoints();
			crossingStairs.DrawStairs();
			return result;
		}

		private void SetLinearSingleRunStairsRailing(LinearSingleRunStairsForm dlg, ref LinearSingleRunStairs Stairs)
		{
			if (dlg.GetOuterRail())
			{
				BaseRaillingData baseRaillingData = new BaseRaillingData();
				double outerRailHeight = dlg.GetOuterRailHeight();
				RailingType outerRailType = dlg.GetOuterRailType();
				baseRaillingData.TheRailingType = outerRailType;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_RunData.PtRunBottomLeft;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = outerRailType;
				baseRaillingData.RailingHeight = outerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_RunData.PtRunTopLeft;
				Stairs.m_listRail.Add(baseRaillingData);
			}
			if (dlg.GetInnerRail())
			{
				BaseRaillingData baseRaillingData2 = new BaseRaillingData();
				double innerRailHeight = dlg.GetInnerRailHeight();
				RailingType innerRailType = dlg.GetInnerRailType();
				baseRaillingData2.TheRailingType = innerRailType;
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.m_ptStart = Stairs.m_RunData.PtRunBottomRight;
				Stairs.m_listRail.Add(baseRaillingData2);
				baseRaillingData2 = new BaseRaillingData();
				baseRaillingData2.TheRailingType = innerRailType;
				baseRaillingData2.RailingHeight = innerRailHeight;
				baseRaillingData2.m_ptStart = Stairs.m_RunData.PtRunTopRight;
				Stairs.m_listRail.Add(baseRaillingData2);
			}
		}

		public bool AddLinearSingleRunStairs()
		{
			LinearSingleRunStairsForm linearSingleRunStairsForm = new LinearSingleRunStairsForm(this.m_Revit);
			DialogResult dialogResult;
			while ((dialogResult = linearSingleRunStairsForm.ShowDialog()) == DialogResult.OK && linearSingleRunStairsForm.theMeasureType != LinearSingleRunStairsForm.MeasureType.MT_None)
			{
				if (LinearSingleRunStairsForm.MeasureType.MT_StairsWidth == linearSingleRunStairsForm.theMeasureType)
				{
					double stairsWidth = 0.0;
					if (this.GetLength("楼梯宽度", ref stairsWidth))
					{
						linearSingleRunStairsForm.StairsWidth = stairsWidth;
						linearSingleRunStairsForm.SaveData();
					}
				}
				else if (LinearSingleRunStairsForm.MeasureType.MT_StairsLength == linearSingleRunStairsForm.theMeasureType)
				{
					double stairsLength = 0.0;
					if (this.GetLength("楼梯长度", ref stairsLength))
					{
						linearSingleRunStairsForm.StairsLength = stairsLength;
						linearSingleRunStairsForm.SaveData();
					}
				}
				else if (LinearSingleRunStairsForm.MeasureType.MT_Angle == linearSingleRunStairsForm.theMeasureType)
				{
					double rotateAngle = 0.0;
					if (this.GetAngle(ref rotateAngle))
					{
						linearSingleRunStairsForm.RotateAngle = rotateAngle;
						linearSingleRunStairsForm.SaveData();
					}
				}
			}
			if (dialogResult == DialogResult.Cancel)
			{
				return false;
			}
			bool result = true;
			double rotateAngle2 = linearSingleRunStairsForm.RotateAngle;
			int insertPointIndex = linearSingleRunStairsForm.GetInsertPointIndex();
			bool upstairs = linearSingleRunStairsForm.GetUpstairs();
			bool noteInfo = linearSingleRunStairsForm.GetNoteInfo();
			bool tbmirror = linearSingleRunStairsForm.GetTBMirror();
			bool lrmirror = linearSingleRunStairsForm.GetLRMirror();
			bool bottomBeam = linearSingleRunStairsForm.GetBottomBeam();
			bool topBeam = linearSingleRunStairsForm.GetTopBeam();
			this.m_StairsCreator = new LinearSingleRunStairsCreator(this.m_Revit);
			LinearSingleRunStairs linearSingleRunStairs = new LinearSingleRunStairs(this.m_StairsCreator);
			linearSingleRunStairs.m_dTopOffset = Common.MMToFeet(linearSingleRunStairsForm.GetTopOffset());
			linearSingleRunStairs.m_dBottomOffset = Common.MMToFeet(linearSingleRunStairsForm.BottomOffset);
			linearSingleRunStairs.m_dStairsWidth = Common.MMToFeet(linearSingleRunStairsForm.StairsWidth);
			linearSingleRunStairs.m_dStairsLength = Common.MMToFeet(linearSingleRunStairsForm.StairsLength);
			linearSingleRunStairs.m_RunData = linearSingleRunStairsForm.GetRunData();
			linearSingleRunStairs.m_listSupport = linearSingleRunStairsForm.GetSupportData();
			linearSingleRunStairs.m_BeamData = linearSingleRunStairsForm.GetBeamData();
			linearSingleRunStairs.m_FloorType = linearSingleRunStairsForm.GetFloorType();
			linearSingleRunStairs.m_arLandWidth = linearSingleRunStairsForm.GetLandWidth();
			linearSingleRunStairs.m_dBottomElevation = linearSingleRunStairsForm.GetBottomElevation();
			linearSingleRunStairs.m_dLevelValue = linearSingleRunStairsForm.GetLevelValue();
			linearSingleRunStairs.m_bNoteUpStairs = noteInfo;
			linearSingleRunStairs.m_sUsingRange = linearSingleRunStairsForm.UsingRange;
			new LinearSingleRunStairsKit(this.m_Revit.Application.Application).LinearSingleRunStairsProfileCurves(ref linearSingleRunStairs, noteInfo, insertPointIndex, lrmirror, tbmirror, upstairs, rotateAngle2, bottomBeam, topBeam);
			this.SetLinearSingleRunStairsRailing(linearSingleRunStairsForm, ref linearSingleRunStairs);
			List<CurveInfo> list = new List<CurveInfo>();
			foreach (SingleRunCurveInfo singleRunCurveInfo in linearSingleRunStairs.m_listRunCurve)
			{
				list.AddRange(singleRunCurveInfo.RunBoundaryCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunRiserCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunPathCurvesInfoList);
			}
			List<JigEdgeInfo> list2 = new List<JigEdgeInfo>();
			foreach (CurveInfo curveInfo in list)
			{
				if (!(null == curveInfo.CurveObj))
				{
					JigEdgeInfo item = new JigEdgeInfo(curveInfo.CurveObj);
					list2.Add(item);
				}
			}
			XYZ xyz = null;
			List<JigTextInfo> textInfos = new List<JigTextInfo>();
			if (!DragCurveJigInterface.GetInsertPosition(this.m_Revit, list2, false, textInfos, false, linearSingleRunStairs.m_TransVector, ref xyz))
			{
				return false;
			}
			linearSingleRunStairs.m_ptRealInsert = xyz;
			linearSingleRunStairs.m_TransVector = xyz - linearSingleRunStairs.m_TransVector;
			Transform transform = RevitVersionFuncs.CreateTranslation(new XYZ(linearSingleRunStairs.m_TransVector.X, linearSingleRunStairs.m_TransVector.Y, 0.0));
			linearSingleRunStairs.m_Transform = transform.Multiply(linearSingleRunStairs.m_Transform);
			linearSingleRunStairs.TransFormRailPoints();
			linearSingleRunStairs.TransFormOutSupportPoints();
			linearSingleRunStairs.DrawStairs();
			return result;
		}

		private void SetArcSingleRunStairsRailing(ArcSingleRunStairsForm dlg, ref ArcSingleRunStairs Stairs)
		{
			if (dlg.GetOuterRail())
			{
				BaseRaillingData baseRaillingData = new BaseRaillingData();
				double innerRailHeight = dlg.GetInnerRailHeight();
				RailingType innerRailType = dlg.GetInnerRailType();
				baseRaillingData.TheRailingType = innerRailType;
				baseRaillingData.RailingHeight = innerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_RunData.PtRunBottomRight;
				Stairs.m_listRail.Add(baseRaillingData);
				baseRaillingData = new BaseRaillingData();
				baseRaillingData.TheRailingType = innerRailType;
				baseRaillingData.RailingHeight = innerRailHeight;
				baseRaillingData.m_ptStart = Stairs.m_RunData.PtRunTopRight;
				Stairs.m_listRail.Add(baseRaillingData);
			}
			if (dlg.GetInnerRail())
			{
				BaseRaillingData baseRaillingData2 = new BaseRaillingData();
				double outerRailHeight = dlg.GetOuterRailHeight();
				RailingType outerRailType = dlg.GetOuterRailType();
				baseRaillingData2.TheRailingType = outerRailType;
				baseRaillingData2.RailingHeight = outerRailHeight;
				baseRaillingData2.m_ptStart = Stairs.m_RunData.PtRunBottomLeft;
				Stairs.m_listRail.Add(baseRaillingData2);
				baseRaillingData2 = new BaseRaillingData();
				baseRaillingData2.TheRailingType = outerRailType;
				baseRaillingData2.RailingHeight = outerRailHeight;
				baseRaillingData2.m_ptStart = Stairs.m_RunData.PtRunTopLeft;
				Stairs.m_listRail.Add(baseRaillingData2);
			}
		}

		public bool AddArcSingleRunStairs()
		{
			ArcSingleRunStairsForm arcSingleRunStairsForm = new ArcSingleRunStairsForm(this.m_Revit);
			DialogResult dialogResult;
			while ((dialogResult = arcSingleRunStairsForm.ShowDialog()) == DialogResult.OK && arcSingleRunStairsForm.theMeasureType != ArcSingleRunStairsForm.MeasureType.MT_None)
			{
				if (ArcSingleRunStairsForm.MeasureType.MT_Width == arcSingleRunStairsForm.theMeasureType)
				{
					double stairsWidth = 0.0;
					if (this.GetLength("楼梯宽度", ref stairsWidth))
					{
						arcSingleRunStairsForm.StairsWidth = stairsWidth;
						arcSingleRunStairsForm.SaveData();
					}
				}
				else if (ArcSingleRunStairsForm.MeasureType.MT_Radius == arcSingleRunStairsForm.theMeasureType)
				{
					double stairsRadius = 0.0;
					if (this.GetLength("楼梯半径", ref stairsRadius))
					{
						arcSingleRunStairsForm.StairsRadius = stairsRadius;
						arcSingleRunStairsForm.SaveData();
					}
				}
				else if (ArcSingleRunStairsForm.MeasureType.MT_Angle == arcSingleRunStairsForm.theMeasureType)
				{
					double rotateAngle = 0.0;
					if (this.GetAngle(ref rotateAngle))
					{
						arcSingleRunStairsForm.RotateAngle = rotateAngle;
						arcSingleRunStairsForm.SaveData();
					}
				}
			}
			if (DialogResult.Cancel == dialogResult)
			{
				return false;
			}
			bool result = true;
			double rotateAngle2 = arcSingleRunStairsForm.RotateAngle;
			int insertPointIndex = arcSingleRunStairsForm.GetInsertPointIndex();
			bool noteInfo = arcSingleRunStairsForm.GetNoteInfo();
			bool topBeam = arcSingleRunStairsForm.GetTopBeam();
			bool bottomBeam = arcSingleRunStairsForm.GetBottomBeam();
			this.m_StairsCreator = new ArcSingleRunStairsCreator(this.m_Revit);
			ArcSingleRunStairs arcSingleRunStairs = new ArcSingleRunStairs(this.m_StairsCreator);
			arcSingleRunStairs.m_dTopOffset = Common.MMToFeet(arcSingleRunStairsForm.GetTopOffset());
			arcSingleRunStairs.m_dBottomOffset = Common.MMToFeet(arcSingleRunStairsForm.BottomOffset);
			arcSingleRunStairs.m_dStairsWidth = Common.MMToFeet(arcSingleRunStairsForm.StairsWidth);
			arcSingleRunStairs.m_dStairsRadius = Common.MMToFeet(arcSingleRunStairsForm.StairsRadius);
			arcSingleRunStairs.m_dIncludeAngle = Common.MMToFeet(arcSingleRunStairsForm.IncludeAngle);
			arcSingleRunStairs.m_RunData = arcSingleRunStairsForm.GetArcRunData();
			arcSingleRunStairs.m_listSupport = arcSingleRunStairsForm.GetSupportData();
			arcSingleRunStairs.m_BeamData = arcSingleRunStairsForm.GetBeamData();
			arcSingleRunStairs.m_FloorType = arcSingleRunStairsForm.GetFloorType();
			arcSingleRunStairs.m_arLandWidth = arcSingleRunStairsForm.GetLandWidth();
			arcSingleRunStairs.m_dBottomElevation = arcSingleRunStairsForm.GetBottomElevation();
			arcSingleRunStairs.m_dLevelValue = arcSingleRunStairsForm.GetLevelValue();
			arcSingleRunStairs.m_bLRMirror = arcSingleRunStairsForm.GetLRMirror();
			arcSingleRunStairs.m_bTBMirror = arcSingleRunStairsForm.GetTBMirror();
			arcSingleRunStairs.m_bNoteUpStairs = noteInfo;
			arcSingleRunStairs.m_sUsingRange = arcSingleRunStairsForm.UsingRange;
			new ArcSingleRunStairsKit(this.m_Revit.Application.Application).ArcSingleRunStairsProfileCurves(ref arcSingleRunStairs, noteInfo, insertPointIndex, rotateAngle2, bottomBeam, topBeam);
			this.SetArcSingleRunStairsRailing(arcSingleRunStairsForm, ref arcSingleRunStairs);
			List<CurveInfo> list = new List<CurveInfo>();
			foreach (SingleRunCurveInfo singleRunCurveInfo in arcSingleRunStairs.m_listRunCurve)
			{
				list.AddRange(singleRunCurveInfo.RunBoundaryCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunRiserCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunPathCurvesInfoList);
			}
			List<JigEdgeInfo> list2 = new List<JigEdgeInfo>();
			foreach (CurveInfo curveInfo in list)
			{
				if (!(null == curveInfo.CurveObj))
				{
					JigEdgeInfo item = new JigEdgeInfo(curveInfo.CurveObj);
					list2.Add(item);
				}
			}
			XYZ xyz = null;
			List<JigTextInfo> textInfos = new List<JigTextInfo>();
			if (!DragCurveJigInterface.GetInsertPosition(this.m_Revit, list2, false, textInfos, false, arcSingleRunStairs.m_TransVector, ref xyz))
			{
				return false;
			}
			arcSingleRunStairs.m_ptRealInsert = xyz;
			arcSingleRunStairs.m_TransVector = xyz - arcSingleRunStairs.m_TransVector;
			Transform transform = RevitVersionFuncs.CreateTranslation(new XYZ(arcSingleRunStairs.m_TransVector.X, arcSingleRunStairs.m_TransVector.Y, 0.0));
			arcSingleRunStairs.m_Transform = transform.Multiply(arcSingleRunStairs.m_Transform);
			arcSingleRunStairs.TransFormRailPoints();
			arcSingleRunStairs.TransFormOutSupportPoints();
			arcSingleRunStairs.DrawStairs();
			return result;
		}

		public bool AddEscalator()
		{
			bool result = true;
			EscalatorForm escalatorForm = new EscalatorForm(this.m_Revit);
			DialogResult dialogResult;
			while ((dialogResult = escalatorForm.ShowDialog()) == DialogResult.OK && escalatorForm.theMeasureType != EscalatorForm.MeasureType.MT_None)
			{
				if (EscalatorForm.MeasureType.MT_RunWidth == escalatorForm.theMeasureType)
				{
					double runWidth = 0.0;
					if (this.GetLength("梯级宽度", ref runWidth))
					{
						escalatorForm.RunWidth = runWidth;
						escalatorForm.SaveData();
					}
				}
				else if (EscalatorForm.MeasureType.MT_Angle == escalatorForm.theMeasureType)
				{
					double rotateAngle = 0.0;
					if (this.GetAngle(ref rotateAngle))
					{
						escalatorForm.RotateAngle = rotateAngle;
						escalatorForm.SaveData();
					}
				}
			}
			if (DialogResult.Cancel == dialogResult)
			{
				return false;
			}
			double num = escalatorForm.RotateAngle;
			num %= Math.PI*2;
			double inclineAngle = escalatorForm.InclineAngle;
			bool noteInfo = escalatorForm.GetNoteInfo();
			bool isRamp = escalatorForm.GetIsRamp();
			bool tbmirror = escalatorForm.GetTBMirror();
			bool lrmirror = escalatorForm.GetLRMirror();
			this.m_StairsCreator = new EscalatorCreator(this.m_Revit);
			Escalator escalator = new Escalator(this.m_StairsCreator);
			EscalatorKit escalatorKit = new EscalatorKit(this.m_Revit.Application.Application);
			escalator.m_FloorType = escalatorForm.GetFloorType();
			escalator.m_PosInsertType = escalatorForm.GetStairsInsertType();
			escalator.m_dStairsHigh = escalatorForm.GetStairsHeight();
			escalator.m_dStairsOffset = escalatorForm.GetStairsOffset();
			escalator.m_dStairsWidth = escalatorForm.GetStairsWidth();
			escalator.m_dRunWidth = escalatorForm.GetRunWidth();
			escalator.m_dRunLength = escalatorForm.GetRunLength();
			escalator.m_dRunDepth = escalatorForm.GetRunDepth();
			escalator.m_LeftRunData = escalatorForm.GetRunData();
			escalator.m_MidOneRunData = escalatorForm.GetRunData();
			escalator.m_MidTwoRunData = escalatorForm.GetRunData();
			escalator.m_RightRunData = escalatorForm.GetRunData();
			escalator.m_UpStairsType = escalatorForm.GetUpstairs();
			escalator.m_PlaceType = escalatorForm.GetPlaceType();
			escalator.m_nRunCount = escalatorForm.GetRunCount();
			escalator.m_dStairsDis = escalatorForm.GetStairsDis();
			escalator.m_bNoteUpStairs = noteInfo;
			escalator.m_dFrontDepth = escalatorForm.GetStairsFrontDepth();
			escalator.m_dStartDepth = escalatorForm.GetStairsStartDepth();
			escalator.m_dTreadDepth = escalatorForm.GetStairsTreadDepth();
			escalator.m_nIndexInsertPos = escalatorForm.GetInsertIndex();
			escalator.m_dHSpan = escalatorForm.GetStairsHSpan();
			escalator.m_dRailHeight = escalatorForm.GetGuardHeight();
			escalator.m_dTopPitLength = escalatorForm.GetTopPitLength();
			escalator.m_dTopPitDepth = escalatorForm.GetTopPitDepth();
			escalator.m_dTopPitExturn = escalatorForm.GetTopPitExturn();
			escalator.m_dBtmPitLength = escalatorForm.GetBtmPitLength();
			escalator.m_dBtmPitDepth = escalatorForm.GetBtmPitDepth();
			escalator.m_dBtmPitExturn = escalatorForm.GetBtmPitExturn();
			escalator.m_sRvtVersion = escalatorForm.GetRevitVeision();
			escalator.m_sFamilyName = escalatorForm.GetFamilyName();
			escalator.m_sSymbolName = escalatorForm.GetFamilySymbolName();
			escalator.m_dRotateAngle = num;
			escalator.m_dInclienAngle = inclineAngle;
			escalator.m_bAsRamp = isRamp;
			escalator.m_bLftRhtTurn = lrmirror;
			escalator.m_bUpDownTurn = tbmirror;
			escalator.m_sNumPreFix = escalatorForm.NumPreFix;
			escalator.m_nNumSerial = escalatorForm.NumSerial;
			escalator.m_sNumSubFix = escalatorForm.NumSubFix;
			escalatorKit.EscalatorProfileCurves(ref escalator, noteInfo, false, lrmirror, tbmirror, num);
			List<CurveInfo> list = new List<CurveInfo>();
			foreach (SingleRunCurveInfo singleRunCurveInfo in escalator.m_listRunCurve)
			{
				list.AddRange(singleRunCurveInfo.RunBoundaryCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunRiserCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunPathCurvesInfoList);
			}
			list.AddRange(escalator.m_listOtherCurve);
			List<JigEdgeInfo> list2 = new List<JigEdgeInfo>();
			foreach (CurveInfo curveInfo in list)
			{
				if (!(null == curveInfo.CurveObj))
				{
					JigEdgeInfo item = new JigEdgeInfo(curveInfo.CurveObj);
					list2.Add(item);
				}
			}
			XYZ xyz = null;
			List<JigTextInfo> textInfos = new List<JigTextInfo>();
			if (!DragCurveJigInterface.GetInsertPosition(this.m_Revit, list2, false, textInfos, false, escalator.m_TransVector, ref xyz))
			{
				return false;
			}
			escalator.m_TransVector = xyz - escalator.m_TransVector;
			escalator.m_ptInsert = xyz;
			Transform transform = RevitVersionFuncs.CreateTranslation(new XYZ(escalator.m_TransVector.X, escalator.m_TransVector.Y, 0.0));
			escalator.m_Transform = transform.Multiply(escalator.m_Transform);
			escalator.DrawStairs();
			return result;
		}

		public void GetFamilyName(ref List<string> listStairsTypeName, ref List<string> listBeamTypeName)
		{
			foreach (string text in Directory.GetFiles(FormParamManager.GetStairsFamiliyPath(this.m_Revit.Application.Application.VersionNumber) + "SteelLadder\\", "*.rfa"))
			{
				if (text.Contains("热轧槽钢.rfa"))
				{
					listBeamTypeName.Add(text);
				}
				else if (text.Contains("热轧H型钢.rfa"))
				{
					listBeamTypeName.Add(text);
				}
				else
				{
					listStairsTypeName.Add(text);
				}
			}
		}

		public bool AddSteelStairs()
		{
			List<string> listStairsTypeName = new List<string>();
			List<string> listBeamTypeName = new List<string>();
			this.GetFamilyName(ref listStairsTypeName, ref listBeamTypeName);
			SteelStairsForm steelStairsForm = new SteelStairsForm(this.m_Revit, listStairsTypeName, listBeamTypeName);
			DialogResult dialogResult;
			while ((dialogResult = steelStairsForm.ShowDialog()) == DialogResult.OK && steelStairsForm.theMeasureType != SteelStairsForm.MeasureType.MT_None)
			{
				if (SteelStairsForm.MeasureType.MT_StairsWidth == steelStairsForm.theMeasureType)
				{
					double stairsWidth = 0.0;
					if (this.GetLength("梯段宽度", ref stairsWidth))
					{
						steelStairsForm.StairsWidth = stairsWidth;
						steelStairsForm.SaveData();
					}
				}
				else if (SteelStairsForm.MeasureType.MT_Angle == steelStairsForm.theMeasureType)
				{
					double rotateAngle = 0.0;
					if (this.GetAngle(ref rotateAngle))
					{
						steelStairsForm.RotateAngle = rotateAngle;
						steelStairsForm.SaveData();
					}
				}
			}
			if (dialogResult == DialogResult.Cancel)
			{
				return false;
			}
			bool result = true;
			bool tbmirror = steelStairsForm.GetTBMirror();
			bool lrmirror = steelStairsForm.GetLRMirror();
			bool flag = steelStairsForm.IsRightAngle();
			this.m_StairsCreator = new SteelStairsCreator(this.m_Revit);
			SteelStairs steelStairs = new SteelStairs(this.m_StairsCreator);
			steelStairs.m_sFamilyName = steelStairsForm.GetFamilyName();
			steelStairs.m_sBeamName = steelStairsForm.GetBeamName();
			steelStairs.m_BeamData = steelStairsForm.GetBeamData();
			steelStairs.m_bRightAngle = flag;
			steelStairs.m_dStairsAngle = steelStairsForm.StairsAngle;
			steelStairs.m_dRotateAngle = steelStairsForm.RotateAngle;
			steelStairs.m_dStairsHeight = Common.MMToFeet(steelStairsForm.StairsHeight);
			steelStairs.m_dBottomOffset = Common.MMToFeet(steelStairsForm.StairsOffset);
			steelStairs.m_dStairsWidth = Common.MMToFeet(steelStairsForm.StairsWidth);
			steelStairs.m_nInsertPointIndex = steelStairsForm.GetInsertPointIndex();
			if (flag)
			{
				steelStairs.m_dStairsLength = 0.0;
			}
			else
			{
				steelStairs.m_dStairsLength = Common.MMToFeet(steelStairsForm.StairsLength);
			}
			steelStairs.m_dTreadHeight = Common.MMToFeet(steelStairsForm.TreadHeight);
			steelStairs.m_dRailingHeight = Common.MMToFeet(steelStairsForm.RailingHeight);
			steelStairs.m_FloorType = steelStairsForm.GetFloorType();
			steelStairs.m_RunData = steelStairsForm.GetRunData();
			steelStairs.m_nInnerRailing = steelStairsForm.GetInnerRail();
			steelStairs.m_nOutRailing = steelStairsForm.GetOuterRail();
			steelStairs.m_bNoteUpStairs = steelStairsForm.GetNoteInfo();
			steelStairs.m_bTBMirror = steelStairsForm.GetTBMirror();
			steelStairs.m_bLRMirror = steelStairsForm.GetLRMirror();
			steelStairs.m_sRvtVersion = this.m_Revit.Application.Application.VersionNumber;
			new SteelStairsKit(this.m_Revit.Application.Application).SteelStairsProfileCurves(ref steelStairs, lrmirror, tbmirror, steelStairs.m_BeamData.m_bBottomBeam, steelStairs.m_BeamData.m_bTopBeam);
			List<CurveInfo> list = new List<CurveInfo>();
			foreach (SingleRunCurveInfo singleRunCurveInfo in steelStairs.m_listRunCurve)
			{
				list.AddRange(singleRunCurveInfo.RunBoundaryCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunRiserCurvesInfoList);
				list.AddRange(singleRunCurveInfo.RunPathCurvesInfoList);
			}
			List<JigEdgeInfo> list2 = new List<JigEdgeInfo>();
			foreach (CurveInfo curveInfo in list)
			{
				if (!(null == curveInfo.CurveObj))
				{
					JigEdgeInfo item = new JigEdgeInfo(curveInfo.CurveObj);
					list2.Add(item);
				}
			}
			XYZ ptInsert = null;
			if (!DragCurveJigInterface.GetInsertPosition(this.m_Revit, list2, false, steelStairs.m_TransVector, ref ptInsert))
			{
				return false;
			}
			steelStairs.m_ptInsert = ptInsert;
			steelStairs.DrawStairs();
			return result;
		}

		private bool GetLength(string strType, ref double length)
		{
			XYZ xyz = null;
			if (!this.GetReferencePoint("点取" + strType + "量取距离起点", ref xyz))
			{
				return false;
			}
			XYZ xyz2 = null;
			if (!this.GetReferencePoint("点取" + strType + "量取距离终点", ref xyz2))
			{
				return false;
			}
			length = Common.FeetToMM(xyz.DistanceTo(xyz2));
			return true;
		}

		private bool GetAngle(ref double angle)
		{
			XYZ xyz = null;
			XYZ xyz2 = null;
			if (!this.GetReferencePoint("选择起始边起点", ref xyz))
			{
				return false;
			}
			if (!this.GetReferencePoint("选择起始边终点", ref xyz2))
			{
				return false;
			}
			try
			{
				double angle2 = Geometry.getAngle(XYZ.Zero, xyz2 - xyz);
				double angle3 = Geometry.getAngle(XYZ.Zero, XYZ.BasisX);
				angle = Geometry.BetweenTheAngles(angle3, angle2, true);
				angle = Geometry.formatAngle(angle);
			}
			catch (Exception)
			{
				angle = 0.0;
				return true;
			}
			return true;
		}

		private bool GetReferencePoint(string statusPrompt, ref XYZ point)
		{
			try
			{
				XYZ xyz = this.m_Revit.Application.ActiveUIDocument.Selection.PickPoint(statusPrompt);
				point = new XYZ(xyz.X, xyz.Y, 0.0);
			}
			catch (Exception)
			{
				return false;
			}
			return true;
		}

		private ExternalCommandData m_Revit;

		private Document m_Document;

		private StairsCreator m_StairsCreator;
	}
}
